Обсуждение: Dynamic SQL

Поиск
Список
Период
Сортировка

Dynamic SQL

От
"Mark Battersby"
Дата:

Hi

 

When looking at PostGres through the eyes of an Oracle Developer I was wondering if PostGres supports a feature called Dynamic SQL. Of course even better would be the ability to run PostGress/PL dynamically too.

 

Dynamic SQL and Dynamic PL/SQL are useful when you don’t know until runtime how your SQL or PL/SQL looks like.

 

Any tips appreciated.

 

/Mark

 

Re: Dynamic SQL

От
John Sidney-Woollett
Дата:
Yes, it does. And it's a lot easier than DBMS_SQL too!

Look at the EXECUTE command in the pl/pgsql programming language.

See http://www.postgresql.org/docs/7.4/interactive/plpgsql-statements.html

John Sidney-Woollett

Mark Battersby wrote:

> Hi
>
>
>
> When looking at PostGres through the eyes of an Oracle Developer I was
> wondering if PostGres supports a feature called Dynamic SQL. Of course even
> better would be the ability to run PostGress/PL dynamically too.
>
>
>
> Dynamic SQL and Dynamic PL/SQL are useful when you don't know until runtime
> how your SQL or PL/SQL looks like.
>
>
>
> Any tips appreciated.
>
>
>
> /Mark
>
>
>
>

Re: Dynamic SQL

От
Shridhar Daithankar
Дата:
Mark Battersby wrote:
> When looking at PostGres through the eyes of an Oracle Developer I was
> wondering if PostGres supports a feature called Dynamic SQL. Of course
> even better would be the ability to run PostGress/PL dynamically too.
>
> Dynamic SQL and Dynamic PL/SQL are useful when you don’t know until
> runtime how your SQL or PL/SQL looks like.

Does this help?

http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/docs/8.0/static/plpgsql-porting.html
http://www.postgresql.org/docs/8.0/static/ecpg-dynamic.html
http://www.postgresql.org/docs/8.0/static/libpq-exec.html

  Shridhar


Re: Dynamic SQL

От
Troels Arvin
Дата:
On Mon, 31 Jan 2005 13:18:38 +0100, Mark Battersby wrote:

> When looking at PostGres through the eyes of an Oracle Developer I was
> wondering if PostGres supports a feature called Dynamic SQL. Of course even
> better would be the ability to run PostGress/PL dynamically too.

PostgreSQL does not conform to the "Basic dynamic SQL" feature of the SQL
standard (feature ID B031). However, PostgreSQL supports some of the
involved concepts, like prepared statements. See
http://www.postgresql.org/docs/8.0/static/ecpg.html and in particular
http://www.postgresql.org/docs/8.0/static/ecpg-dynamic.html

--
Greetings from Troels Arvin, Copenhagen, Denmark