Re: Cursor - Mailing list pgsql-general

From Bob Pawley
Subject Re: Cursor
Date
Msg-id 00b801c8f1c4$0a078c50$6401a8c0@owner
Whole thread Raw
In response to Cursor  ("Bob Pawley" <rjpawley@shaw.ca>)
Responses Re: Cursor
Re: Cursor
List pgsql-general
Following is more complete. The balance of the trigger that is not shown
works when tested separately. I didn't include it because it is quite long.

Bob


 DECLARE
 process_total integer ;
 process_id integer ;
 procgraphic cursor for select process_id from p_id.p_id, processes_count
   where p_id.p_id.p_id_id = processes_count.p_id_id;

 begin

 Insert into processes_count (p_id_id)
 select new.p_id_id from project.project ;

 Select count (p_id.p_id.process_id) INTO process_total
   FROM p_id.p_id, processes_count
   Where p_id.p_id.p_id_id = processes_count.p_id_id;

   Open procgraphic;

 Fetch first from procgraphic into process_id;

 Update p_id.p_id
 set proc_graphic_position = one
 From graphics.proc_position, processes_count
 where graphics.proc_position.proc_count = process_total
 and process_id = p_id.p_id.process_id;





----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Richard Huxton" <dev@archonet.com>
Cc: "Bob Pawley" <rjpawley@shaw.ca>; "PostgreSQL"
<pgsql-general@postgresql.org>
Sent: Tuesday, July 29, 2008 2:35 PM
Subject: Re: [GENERAL] Cursor


> Richard Huxton <dev@archonet.com> writes:
>> Bob Pawley wrote:
>>> DECLARE
>>> procgraphic cursor for select process_id from p_id.p_id,
>>> processes_count    where p_id.p_id.p_id_id = processes_count.p_id_id;
>>>
>>> begin
>>>
>>> Open procgraphic ;
>
>> There is no OPEN, you just FETCH
>
> No, he does need an OPEN.  The extract looks correct as far as it goes,
> so I think the mistake was in something that was omitted.
>
> regards, tom lane


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cursor
Next
From: "John Cheng"
Date:
Subject: Re: How do I set up automatic backups?