From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Tzuriel Kahlon <tzuriel.kahlon@surecomp.com>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: ecpg Fetch issue
Date: Mon, 10 Nov 2025 13:43:03 +0200
Message-ID: <0e268e59-cc7b-4c0d-aedc-3cfe2db9af45@iki.fi> (raw)
In-Reply-To: <AM9PR06MB8017AE706EA6FEC256523716FDC1A@AM9PR06MB8017.eurprd06.prod.outlook.com>
References: <AM9PR06MB8017AE706EA6FEC256523716FDC1A@AM9PR06MB8017.eurprd06.prod.outlook.com>
On 09/11/2025 15:26, Tzuriel Kahlon wrote:
> Hey ,
> my progra running from Cobol and im using ECPG for that the issue is
> when i use FETCH command the fetch going one by one
> and not take all the rows in batch , there is any solution for that
> regard to change the code itself ?
There's an example in the docs that fetches multiple rows into an array.
See https://www.postgresql.org/docs/18/ecpg-descriptors.html:
> PostgreSQL supports retrieving more that one record in one FETCH statement and storing the data in host variables in this case assumes that the variable is an array. E.g.:
>
> EXEC SQL BEGIN DECLARE SECTION;
> int id[5];
> EXEC SQL END DECLARE SECTION;
>
> EXEC SQL FETCH 5 FROM mycursor INTO SQL DESCRIPTOR mydesc;
>
> EXEC SQL GET DESCRIPTOR mydesc VALUE 1 :id = DATA;
P.S. Please post usage questions like this to pgsql-general in the
future, the pgsql-bugs list is for reporting bugs.
- Heikki
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-bugs@postgresql.org
Cc: hlinnaka@iki.fi, tzuriel.kahlon@surecomp.com
Subject: Re: ecpg Fetch issue
In-Reply-To: <0e268e59-cc7b-4c0d-aedc-3cfe2db9af45@iki.fi>
* 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