Retriving cursor from pgplsql function

From: "Fernando Papa" <fpapa(at)claxson(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Retriving cursor from pgplsql function
Date: 2002-11-12 18:49:11
Message-ID: CB94A4924490EC4A81EDA55BA378B7BA5715D2@exch2k01.buehuergo.corp.claxson.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


I resend this post because I can't find any answer for this... I try and
try but can't find how to do this.
-------------


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.


This is the "head" of function:
--------------
create or replace function match(refcursor,int8) returns
refcursor as ' DECLARE
vid ALIAS FOR $2;
vcursor ALIAS FOR $1;
BEGIN
(...)
return vcursor;
(...)
--------------

And this is php call:
--------------
$conn = pg_pconnect ($conn_string);
$qry = "BEGIN; SELECT
matche('cursorsalida',$identificador); fetch all in cursorsalida; ";
$result = pg_query ($conn, $qry);
$num = pg_num_rows($result);
for ($i=0; $i < $num; $i++) {
$r = pg_fetch_row($result, $i);
(...)
---------------


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...

Thanks in advance!

--
Fernando O. Papa

Browse pgsql-php by date

  From Date Subject
Next Message David Busby 2002-11-13 19:29:32 Need to select and update with the same sql statement
Previous Message scott.marlowe 2002-11-12 17:12:39 Re: [SQL] Parent table has not oid?