RE: Procedure en postgres

From: Hensa <hensa22(at)yahoo(dot)es>
To: Eliana Gutierrez <egp1962(at)yahoo(dot)com(dot)au>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: RE: Procedure en postgres
Date: 2006-11-06 00:40:50
Message-ID: 20061106004050.79326.qmail@web30805.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

si necesitas usar cursores puedes hacerlo asi :

begin
select myfun('xcur');
FETCH ALL FROM xcur;
commit;

Eliana Gutierrez <egp1962(at)yahoo(dot)com(dot)au> escribió: Estoy usando este procedure

CREATE FUNCTION myfun(OUT mycursor refcursor) AS
$BODY$begin
OPEN mycursor FOR
SELECT
processes."PT_DLL_ID" AS pt_dll_id,
processes."PT_P_ID" AS pt_p_id,
processes."PT_CONTEXT" AS pt_context,
processes."PT_CURRENT_STEP" AS pt_current_step,
processes."PT_TIMER_IN" AS pt_timer_in,
processes."PT_TIMER_OUT" AS pt_timer_out,
processes."PT_PRIORITY" AS pt_priority,
processes."PT_STATUS" AS pt_status,
processes."PT_CHAMELEON_ID" AS pt_chameleon,
dllregistry."DLLT_DLL_LOCATION" AS dllt_dll_location,
processregistry."PR_LOCATIONT_ORI" AS pr_location_ori
FROM processes JOIN dllregistry ON processes."PT_DLL_ID" = dllregistry."DLLT_DLL_ID"
JOIN processregistry ON processes."PT_P_ID" = processregistry."PR_P_ID"
AND processes."PT_DLL_ID" = processregistry."PR_DLL_ID"
WHERE "PT_STATUS" = 0
ORDER BY pt_dll_id, pt_p_id, pt_context
LIMIT 1;
CLOSE mycursor;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;

nose que estoy haciendo mal que al ejecutarlo por pgadmin con la sentence
SELECT myfun(); me retorna
Row myfun(refcursor)
1 "<unnamed portal 5>"

Agracederia si alguien puede ayudarme pls.

Eliana

Send instant messages to your online friends http://au.messenger.yahoo.com

Henry

---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Gunnar Wolf 2006-11-06 01:41:42 Re: Seguridad en PostgreSQL
Previous Message Linder Poclaba 2006-11-05 23:36:30 Re: Procedure en postgres