Re: Prepared statements in PGSQL functions - Mailing list pgsql-sql

From A. Kretschmer
Subject Re: Prepared statements in PGSQL functions
Date
Msg-id 20060614133043.GE23895@webserv.wug-glas.de
Whole thread Raw
In response to Prepared statements in PGSQL functions  ("Milen Kulev" <makulev@gmx.net>)
List pgsql-sql
am  14.06.2006, um 15:12:36 +0200 mailte Milen Kulev folgendes:
> How to solve my problem ? Is it possible at all to call prepared statement inside a function at all?

Yes, i have a example:

create or replace function foo() returns text as $$
declare sql text;
begin       sql := 'prepare bla(int) as select now();';       execute sql;       sql := 'execute bla(1);';
executesql;       return 'ready';
 
end
$$ language plpgsql;

test=*# select foo(); foo
-------ready
(1 row)

You should execute strings in plpgsql, not prepared statements.


HTH, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net===    Schollglas Unternehmensgruppe    === 


pgsql-sql by date:

Previous
From: "Milen Kulev"
Date:
Subject: Prepared statements in PGSQL functions
Next
From: "Aaron Bono"
Date:
Subject: Re: how to replace 0xe28093 char with another one?