Re: Operations widh CURSORS - Mailing list pgsql-general

From Jurgen Defurne
Subject Re: Operations widh CURSORS
Date
Msg-id 39389E4F.A907ECA8@glo.be
Whole thread Raw
In response to Operations widh CURSORS  (Marcos Barreto de Castro <mbdecastro@yahoo.com>)
List pgsql-general
Marcos Barreto de Castro wrote:

> Hi,
>
>   Is it possible to declare 2 cursors in the same
> transaction?
>   I am issuing a "BEGIN WORK" statement, after that I
> am issuing "DECLARE c_cursor FOR SELECT * FROM table".
> When, after that, I issue "DECLARE c_cursor1 FOR
> SELECT COUNT(*) FROM table" I get a segmentation
> fault.
>   Is there a way to avoid this and still be able to
> open 2 cursors in the same transaction?
>   Thanks a lot.
>
> Marcos Castro
> email: mbdecastro@yahoo.com
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos -- now, 100 FREE prints!
> http://photos.yahoo.com

You do not need to declare your cursors inside your transaction. A
cursor
is like a kind of data structure : you declare it and then you use it
at will whenever you need it.

<Declare cursors here>

BEGIN WORK;

-- Open cursors here

-- Work with cursors here

-- COMMIT or ROLLBACK, depending on the outcome of your program

Jurgen Defurne
defurnj@glo.be




pgsql-general by date:

Previous
From: Margaretha Sulistyoningsih
Date:
Subject: Saving MPEG video ???
Next
From: Jurgen Defurne
Date:
Subject: Re: to pickle or not to pickle