Retriving cursor from pgplsql function
am 12.11.2002 19:49:11 von Fernando PapaI resend this post because I can't find any answer for this... I try and
try but can't find how to do this.
-------------
=20
=20
Hi all!
I'm new on postgres stuffs... I'm trying to create several functions to
encapsulate "bussines procedures"... actually I need to return a cursor
to php, and these cursor will be returned by stored procedure in
pg/plsql.
=20
=20
This is the "head" of function:
--------------
create or replace function match(refcursor,int8) returns=20
refcursor as ' DECLARE
vid ALIAS FOR $2;
vcursor ALIAS FOR $1;
BEGIN
(...)
return vcursor;
(...)
--------------
=20
And this is php call:
--------------
$conn =3D pg_pconnect ($conn_string);
$qry =3D "BEGIN; SELECT=20
matche('cursorsalida',$identificador); fetch all in cursorsalida; ";
$result =3D pg_query ($conn, $qry);
$num =3D pg_num_rows($result);
for ($i=3D0; $i < $num; $i++) {
$r =3D pg_fetch_row($result, $i);
(...)
---------------
=20
=20
The problem with this is than I need to pass the cursor to the
function... when I try to create a function who doesn't receive a
"refcursor" (only "return" the refcursor), I can't use the cursor! I
think I'm not doing this in the best way... actually this works fine,
but I don't want to pass by parameter a cursor...
=20
Thanks in advance!
=20
--
Fernando O. Papa
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)