Re: como anidar funciones plpgsql

From: "Carlos Mendez" <lucas1850(at)gmail(dot)com>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: como anidar funciones plpgsql
Date: 2008-01-31 13:47:47
Message-ID: 4610af1f0801310547y5d017850v2ded16119db3012d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola,
ejecuto la sgte funcion:

CREATE OR REPLACE FUNCTION unirfunc()
RETURNS integer AS
$BODY$DECLARE
consulta varchar;
result integer;
BEGIN
--consulta:='select insertar()';
--raise notice 'LA CONSULTA ES: %',consulta;
--execute consulta5 into result;
perform insertar();
--raise notice 'el resultado es: %',result;
RETURN 1;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION unirfunc() OWNER TO carlos;

para ejecutar la funcion voy al pgadminIII a la venta query tool y escribo:
select unirfunc(); y ejecuto
el resultado en la pestaña data output me dice 1 es decir al parecer no
existe error, voy a la pestaña messages y ahi encuentro el mensaje que
mencione anteriormente:

CONTEXTO: SQL statement "SELECT insertar()"
PL/pgSQL function "unirfunc" line 8 at perform

como en la funcion insertar() utilizo utilizo bucles, puse varios raise
notice para ir testeando la funcion, por lo tanto el mensaje contexto me
aparece varias veces y los notice tambien,
antes de contexto solo aparece notices he aqui un ejemplo:

NOTICE: al principio bandera vale: <NULL>
CONTEXTO: SQL statement "SELECT insertar()"
PL/pgSQL function "unirfunc" line 8 at perform
NOTICE: select * from alumnos where id=1 //esta consulta la escribi con
raise notice
CONTEXTO: SQL statement "SELECT insertar()"
PL/pgSQL function "unirfunc" line 8 at perform
NOTICE: llegamos
CONTEXTO: SQL statement "SELECT insertar()"
PL/pgSQL function "unirfunc" line 8 at perform

cuando ejecuto *directamente* la funcion insertar() no aparece ningun
"CONTEXTO:" solo los notice que yo le puse,

Gracias de antemano por la ayuda,
saludos.

2008/1/31, Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
>
> Carlos Mendez escribió:
> > Hola, gracias por responder,
> >
> > probe con perform, ahora sale:
> >
> > CONTEXTO: SQL statement "SELECT insertar()"
> > PL/pgSQL function "unirfunc()" line 8 at perform
> >
> > y en la linea 8 creo, tengo lo sgte:
> >
> > perform insertar();
>
> Que aparece antes de la linea CONTEXTO?
>
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2008-01-31 14:19:47 Re: como anidar funciones plpgsql
Previous Message Alvaro Herrera 2008-01-31 12:42:04 Re: como anidar funciones plpgsql