Skip site navigation (1) Skip section navigation (2)

Re: Cursor

From: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Richard Huxton" <dev(at)archonet(dot)com>
Cc: "PostgreSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cursor
Date: 2008-07-29 21:42:45
Message-ID: 00b801c8f1c4$0a078c50$6401a8c0@owner (view raw or flat)
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: "Bob Pawley" <rjpawley(at)shaw(dot)ca>; "PostgreSQL" 
<pgsql-general(at)postgresql(dot)org>
Sent: Tuesday, July 29, 2008 2:35 PM
Subject: Re: [GENERAL] Cursor


> Richard Huxton <dev(at)archonet(dot)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 


In response to

Responses

pgsql-general by date

Next:From: John ChengDate: 2008-07-29 21:47:23
Subject: Re: How do I set up automatic backups?
Previous:From: Tom LaneDate: 2008-07-29 21:35:52
Subject: Re: Cursor

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group