[Pgsql-ayuda] Invocacion de una funcion
Gunnar Wolf
gwolf@gwolf.cx
Tue, 12 Aug 2003 21:50:52 -0500
Edwin Quijada dijo [Tue, Aug 12, 2003 at 04:53:20PM -0400]:
> Estoy haciendo mi primera funcion con pl/sql y cuando la ejecuto me da el
> sigte error
> Error occurred while executing PL/pgSQL function get_secuencia
> WARNING: line 6 at SQL statement
> ERROR: SELECT query has no destination for result data.
> If you want to discard the results, use PERFORM instead.
Veamos cuál es tu línea 6 y 7...
> (...)
> select * from t_secuencias --Haciendo la busqyueda con el tipo doc
> where f_tipo_documento = $1 for update;
> if Not found then --Insertando si es un doc. nuevo
> (...)
Aquí estás pidiendo que Postgres te entregue un conjunto de renglones -
pero no los estás recibiendo en ningún lugar. Perform hace básicamente
lo mismo que select, pero sin guardar el resultado -
http://www.postgresql.org/docs/7.3/static/plpgsql.html (y probablemente
otras muchas).
No sé si esto te guarde el resultado que requieres - 'if not found'. En
todo caso, puedes dirigir tu salida hacia una variable tipo
t_secuencias%rowtype:
declare
(...)
var t_secuencias%rowtype;
begin
(...)
select into var * from t_secuencias where f_tipo_documento = $1 for update;
Saludos,
--
Gunnar Wolf - gwolf@gwolf.cx - (+52-55)5630-9700 ext. 1366
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973 F800 D80E F35A 8BB5 27AF