Re: Ecpg fetch issue

From: Juan Rodrigo Alejandro Burgos Mella <rodrigoburgosmella(at)gmail(dot)com>
To: Tzuriel Kahlon <tzuriel1986(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Ecpg fetch issue
Date: 2025-12-09 20:27:41
Message-ID: CAHbZ42zwfodkVVHRU_4C4xOVh_hr1Pw0w4FueXj=srEZXwn=ag@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi
When using ECPG, if you have a simple FETCH, it will do it row by row; the
way to download more than one row at a time is by using data arrays.
In my case, when I want to extract, for example, 100 records at once, I use
the following model:

I define a data array:

EXEC SQL BEGIN DECLARE SECTION;
struct _resultData {
int int_data1;
char chr_data2[11];
} resultData[100];
EXEC SQL END DECLARE SECTION;

and then in the fetch:

EXEC SQL
FETCH FORWARD 100 cCursor
INTO :resultData;

and the variable sqlca.sqlerrd[2] controls the number of records returned

I hope it helps you

Atte
JRBM

El mar, 9 dic 2025 a las 14:53, Tzuriel Kahlon (<tzuriel1986(at)gmail(dot)com>)
escribió:

> Hey all ,
> We are using IBM for cobol and connextint postgres db with ecpg the
> precompiler , problem is when we running cursor against db the prefetch are
> not set correctly and provide one row each time he approach to db and this
> decrease the performance significantly if twvle have 100000 rows it take it
> one by one each run .
> In procob which is the precompiler of Oracle there are option to set the
> prefetch to take in each time it approach the db x number of rows you want
> and this ease the db retrieved and enhance the performance .
> I know that there is a way to change the setting in the application code,
> but I want to eliminate touch any code and configure only the ecpg which is
> the middle between cobol and db.
> There is anyone from you which encountered same issue?
>
>
>
>
>
> *בברכה *
> *צוריאל כחלון *
> 0523851143
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tzuriel Kahlon 2025-12-09 20:30:14 Re: Ecpg fetch issue
Previous Message Tzuriel Kahlon 2025-12-09 19:53:06 Ecpg fetch issue