X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B24D53A3D12 for ; Wed, 10 Nov 2004 14:22:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65432-01 for ; Wed, 10 Nov 2004 14:22:41 +0000 (GMT) Received: from smtp3.libero.it (smtp3.libero.it [193.70.192.127]) by svr1.postgresql.org (Postfix) with ESMTP id 655B43A1D98 for ; Wed, 10 Nov 2004 14:22:43 +0000 (GMT) Received: from localhost (172.16.1.83) by smtp3.libero.it (7.0.027-DD01) id 4178F14A004BD080 for pgsql-interfaces@postgresql.org; Wed, 10 Nov 2004 15:22:43 +0100 Received: from libero.it (172.16.1.102) by smtp20.libero.it (7.0.027-DD01) id 40E3F8E400BCFB75 for pgsql-interfaces@postgresql.org; Wed, 10 Nov 2004 15:22:43 +0100 Date: Wed, 10 Nov 2004 15:22:43 +0100 Message-Id: Subject: Re: ecpg: using a cursor returned by a stored function MIME-Version: 1.0 X-Sensitivity: 3 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable From: "Gaetano Sferra" To: "pgsql-interfaces" X-XaM3-API-Version: 4.1 (B27) X-type: 0 X-SenderIP: 217.59.38.133 X-Virus-Scanned: by amavisd-new at libero.it serv4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/21 X-Sequence-Number: 5147 Hello, I've found a solution, may be it isn't "chic" and may be it is a = ECPG bug but it work. Follow this example: -- This is the stored fun= ction CREATE FUNCTION myfunc(refcursor) RETURNS refcursor AS' DECLARE=0D = ref ALIAS FOR $1; BEGIN OPEN ref FOR SELECT * FROM mytable; RETURN ref= ; END; -- This is a piece of ECPG that call the stored function above= EXEC SQL SELECT myfunc('mycursor'); while (sqlca.sqlcode !=3D 100) {=0D = EXEC SQL FETCH mycursor INTO ... ... ; ... ... ... } EXEC SQL CLOSE my= cursor; compiling the above piece of code the ECPG compiler will outpu= t: filename.pgc:xx: ERROR: trying to acces an undeclared cursor mycursor= but it will produce a complete filename.c output anyway and compiling= it with cc or gcc you will the SELECT output. It isn't nice but work = :) If you have any other ideas please post it to me, thank you. Gaeta= no Sferra =0A=0A=0A=0A__________________________________________________= __________=0ALibero ADSL: navighi gratis a 1.2 Mega, senza canone e costi= di attivazione. =0AAbbonati subito su http://www.libero.it =0A