Re: PG and dynamic statements in stored procedures/triggers? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: PG and dynamic statements in stored procedures/triggers?
Date
Msg-id 201103070655.08309.adrian.klaver@gmail.com
Whole thread Raw
In response to Re: PG and dynamic statements in stored procedures/triggers?  (Durumdara <durumdara@gmail.com>)
Responses Re: PG and dynamic statements in stored procedures/triggers?  (Bill Thoen <bthoen@gisnet.com>)
List pgsql-general
On Monday, March 07, 2011 6:45:11 am Durumdara wrote:
> Hi!
>
> Thanks!
>
> How do I create "cursor" or "for select" in PGSQL with dynamic way?
>
> For example
>
> :tbl = GenTempTableName()
>
> insert into :tbl...
> insert into :tbl...
> insert into :tbl...
>
> for select :part_id from :tbl begin
>     exec 'select count(*) from subitems where id = ?' using :part_id into
>
> :sumof
>
>     update :tbl set sumof = :sumof where part_id=:part_id
> end;
>
> Can you show me same example?

There are examples in the docs at the link provided. Though I would suggest
reading the pl/pgsql documentation from the beginning to get an idea of its
structure.

>
> Thanks:
>     dd

--
Adrian Klaver
adrian.klaver@gmail.com

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: pg_dump slow with bytea data
Next
From: yagru_alvarez
Date:
Subject: Logic AND between some strings