Lo siento... 2008/12/13 Julio Cesar Rodriguez Dominguez <[email protected]>
> > > 2008/12/12 M C <[email protected]> > >> Estoy tratando de recuperar el valor de un campo serial inmediatamente >> despues de hacer un INSERT con la siguiente función >> >> >> CREATE OR REPLACE FUNCTION agregar_item_menu(integer, integer, integer, >> bpchar, bpchar) >> RETURNS serial AS >> $BODY$ >> BEGIN >> INSERT INTO menu (id_padre, posicion, nivel, titulo, pagina) VALUES >> ($1,$2,$3,$4,$5) >> RETURNING menu.id_item.currval(); >> > Por qué no usar simplemente, INSERT INTO menu VALUES > (DEFAULT,valor_posicion,valor_nivel,valor_titulo,valor_pagina) returning > id_padre; ? > > >> >> END >> $BODY$ >> LANGUAGE 'plpgsql' VOLATILE; >> ALTER FUNCTION agregar_item_menu(integer, integer, integer, bpchar, >> bpchar) OWNER TO postgre; >> >> >> pero me da el siguiente error al ejecutar la función >> >> >> ERROR: query has no destination for result data >> SQL state: 42601 >> Context: PL/pgSQL function "agregar_item_menu" line 2 at SQL statement >> > > > > -- > :: God bless you, every day and every night :: > -- :: God bless you, every day and every night ::
