@Zegarek:
I'm using only one db, only one session, only one connection, so by PgAdmin and ODBC.
The function has the variable "doppie_ricette" declared locally, and this name is never used elsewhere.
The very problems are:
In the test cases, the query used in the cursor "doppie_ricette" never returns any row.
If I execute - like all the processing data before this procedure - in the PgAdmin environment, everything goes well, without errors; but if I do this in a PowerBuilder (12.6) program, doing exactly the same steps, when I call this procedure I obtain the error. The sequence of operations (INSERTs, CALLs) is obviously the same, and it's on a unique connection on the same PG 17 DB.
I have done only one direct setting of the ODBC connection: "SET CLIENT_ENCODING TO 'UTF8'", for the rest the configuration of the ODBC is the original one.
A