From: | "Talha Khan" <talha(dot)amjad(at)gmail(dot)com> |
---|---|
To: | "Milen Kulev" <makulev(at)gmx(dot)net> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Pipelined functions in Postgres |
Date: | 2006-09-19 21:07:58 |
Message-ID: | f80885fc0609191407p496ac28dy5825698e7b5065d0@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi Milen,
Pipelined function is a code that acts like a database table.
Inorder to use this functionality in postgres you would need to write the
function like this
CREATE OR REPLACE FUNCTION get_test_data (numeric)
RETURNS SETOF RECORD AS
$$
DECLARE
temp_rec RECORD;
BEGIN
FOR temp_rec IN (SELECT ename FROM emp WHERE sal > $1)
LOOP
RETURN NEXT temp_rec;
END LOOP;
RETURN;
END;
$$ LANGUAGE plpgsql;
now inorder to call this function you would write the code as follows
SELECT * FROM get_test_data(1000) AS t1 (emp_name VARCHAR);
Regards
Talha Amjad
On 9/19/06, Milen Kulev <makulev(at)gmx(dot)net> wrote:
>
> Hello Lister,
> I am curios whether I can emulate the Oracle pipelined functions
> functionality in PG too (using RETURN NEXT ). For more
> information and examples about Oracle pipelined functions see:
>
> http://asktom.oracle.com/pls/ask/f?p=4950:8:8127757633768425921::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:4447489221109
>
> I have used pipeline functions in DWH enviromnent with success and would
> like
> To use similar concept in PG too.
>
> Any help, examples , links and shared experiences would be greately
> appreciated.
>
> Best Regards.
> Milen
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
From | Date | Subject | |
---|---|---|---|
Next Message | Milen Kulev | 2006-09-19 21:22:15 | Re: Pipelined functions in Postgres |
Previous Message | Shoaib Mir | 2006-09-19 21:05:17 | Re: Pipelined functions in Postgres |