| From: | Joel Burton <joel(at)joelburton(dot)com> |
|---|---|
| To: | Ferdinand Smit <ferdinand(at)telegraafnet(dot)nl> |
| Cc: | <pgsql-admin(at)postgresql(dot)org> |
| Subject: | Re: About a PL/pgSQL function |
| Date: | 2002-06-06 16:41:32 |
| Message-ID: | Pine.LNX.4.30.0206061239340.12975-100000@temp.joelburton.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
On Thu, 6 Jun 2002, Ferdinand Smit wrote:
> When i create a function with a "static" table name, it works fine.
> EXECUTE does not allow SELECT INTO, so does anyone have an other solution?
Use:
DECLARE
cursorname refcursor;
varname int;
BEGIN
OPEN cursorname FOR EXECUTE ''SELECT ... FROM '' || $1 || ...;
FETCH cursorname INTO varname;
CLOSE cursorname;
RETURN varname;
END;
--
Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Lee Green | 2002-06-06 16:45:09 | Re: [GENERAL] performance issue using DBI |
| Previous Message | Dan Langille | 2002-06-06 16:33:54 | Re: [GENERAL] performance issue using DBI |