pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Maurizio <maurizio@dreamtech-it.com>
To: pgsql-interfaces@postgresql.org
Subject: USE OF CURSORS IN ECPG
Date: Tue, 7 Nov 2000 17:52:00 +0100
Message-ID: <001101c048db$38a74d60$7394fea9@maurizio> (raw)

Hi,
I'm just starded using ecpg and I have some problem with cursors.

I wrote this lines

exec sql begin declare section;
    char query[500];
    int CodImpianto;
    int Cod1;
    int Cod2;
    char Descr[100];
exec sql end declare section;
strcpy(query, "select ............");

exec sql connect db;

sub1()
{
    exec sql prepare stmtunimpianto from :query;
    exec sql declare CUR_UNIMPIANTO cursor for stmtunimpianto;
    .
    .
    .

    exec sql open CUR_UNIMPIANTO using :CodImpianto;
    exec sql fetch CUR_UNIMPIANTO into :CodImpianto, :Descr;
    .
    .

    exec sql close CUR_UNIMPIANTO;
    exec sql execute StmtUpdImpianti using :Cod1, :Descr, :Cod2;
    exec sql commit;
}

I call this routine a lot of time.
If I rem the commit all works fine but if I execute the commit the cursor was deleted and I receive some errors.

At open cursor : sqlca.sqlcode = -230 Invalid statement namei in line ......
at fetch           : NOTICE : PerformPortalFetch: portal "cur_unimpianto" not found

Please could anyone help me ?

thanks

regards
Maurizio Cauci
DREAMTECH di Cauci Maurizio
Via Ronchetti, 2 - 21013 Gallarate (VA)
www.dreamtech-it.com

view thread (4+ messages)  latest in thread

Message-ID: <001101c048db$38a74d60$7394fea9@maurizio>
Permalink:  ../001101c048db$38a74d60$7394fea9@maurizio/
Also on:    postgresql.org/message-id/001101c048db$38a74d60$7394fea9@maurizio

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: maurizio@dreamtech-it.com
  Subject: Re: USE OF CURSORS IN ECPG
  In-Reply-To: <001101c048db$38a74d60$7394fea9@maurizio>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox