pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDynamic SQL
5+ messages / 5 participants
[nested] [flat]
* Dynamic SQL
@ 2000-08-22 20:42 BouSaada Nabil <nabil_68@hotmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: BouSaada Nabil @ 2000-08-22 20:42 UTC (permalink / raw)
To: pgsql-sql
Hi,
Is it possible to execute a dynamic sql query in pl/pgsql like
the oracle feature for PL/SQL: EXECUTE IMMEDIATE 'UPDATE my_table SET
col1=val1 ....';
Thanks.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
^ permalink raw reply [nested|flat] 5+ messages in thread
* dynamic sql
@ 2007-02-09 14:15 Gabriel Adolfo Sirni <gsirni@yahoo.com>
0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Adolfo Sirni @ 2007-02-09 14:15 UTC (permalink / raw)
To: pgsql-sql
Error using the command EXECUTE IMMEDIATE with an OUT
parameter
Example: I have this procedure pr_prueba, who call
other procedure "pr_out_area_code" using the command
execute immediate, who has an IN paramter and an OUT
paramter.
Procedure pr_prueba(param in varchar2) is
v_name varchar2(50);
BEGIN
EXECUTE IMMEDIATE ' Begin pr_out_area_code(:1,:2);
End; ' USING param, OUT v_name;
END;
When I execute the procedure pr_prueba
begin
pr_prueba('3491');
end;
The result is the following
ERROR: EDB-42601: syntax error at or near "$1" at
character 14
QUERY: SELECT out $1
LINE 1: SELECT out $1
I had make another test without an OUT parameter and
it works fine, but when I include an OUT parameter it
dosen't work.
Gabriel Adolfo Sirni
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: dynamic sql
@ 2007-02-09 15:24 Tom Lane <tgl@sss.pgh.pa.us>
parent: Gabriel Adolfo Sirni <gsirni@yahoo.com>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2007-02-09 15:24 UTC (permalink / raw)
To: Gabriel Adolfo Sirni <gsirni@yahoo.com>; +Cc: pgsql-sql
Gabriel Adolfo Sirni <gsirni@yahoo.com> writes:
> Procedure pr_prueba(param in varchar2) is
> v_name varchar2(50);
> BEGIN
> EXECUTE IMMEDIATE ' Begin pr_out_area_code(:1,:2);
> End; ' USING param, OUT v_name;
> END;
You're asking the wrong people; this is not an Oracle mailing list.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Dynamic sql
@ 2011-09-10 06:45 Gabriel Filipiak <gabriel.filipiak@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Filipiak @ 2011-09-10 06:45 UTC (permalink / raw)
To: pgsql-sql
Hi, this is my first on this list.
I want to know the basics of dynamic sql especially in PostgreSQL. I was
googling for a while but have no luck for getting a good described examples.
Maybe someone here could give me some links to the materials from which you
where studying this subject.
Ok so to be more accurate I am interested in examples of especially PL/SQL
(PostgreSQL) code which will demonstrate examples with description :)
Best regards
Gabe
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Dynamic sql
@ 2011-09-10 09:18 Jasen Betts <jasen@xnet.co.nz>
parent: Gabriel Filipiak <gabriel.filipiak@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Jasen Betts @ 2011-09-10 09:18 UTC (permalink / raw)
To: pgsql-sql
On 2011-09-10, Gabriel Filipiak <gabriel.filipiak@gmail.com> wrote:
> --bcaec517adbceea3c804ac90a376
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi, this is my first on this list.
>
> I want to know the basics of dynamic sql especially in PostgreSQL. I was
> googling for a while but have no luck for getting a good described examples.
> Maybe someone here could give me some links to the materials from which you
> where studying this subject.
Usually I go to the manual first.
http://www.postgresql.org/docs/9.0/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-...
some things to consider: use quote_identifier and quote_literal when
passing names and values into the sql statements: you can't pass
variables in, only their values.
--
⚂⚃ 100% natural
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2011-09-10 09:18 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-22 20:42 Dynamic SQL BouSaada Nabil <nabil_68@hotmail.com>
2007-02-09 14:15 dynamic sql Gabriel Adolfo Sirni <gsirni@yahoo.com>
2007-02-09 15:24 ` Re: dynamic sql Tom Lane <tgl@sss.pgh.pa.us>
2011-09-10 06:45 Dynamic sql Gabriel Filipiak <gabriel.filipiak@gmail.com>
2011-09-10 09:18 ` Re: Dynamic sql Jasen Betts <jasen@xnet.co.nz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox