| From: | Gunnar Wolf <gwolf(at)gwolf(dot)cx> | 
|---|---|
| To: | Edwin Quijada <listas_quijada(at)hotmail(dot)com> | 
| Cc: | Pgsql <pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx> | 
| Subject: | Re: [Pgsql-ayuda] Invocacion de una funcion | 
| Date: | 2003-08-13 02:50:52 | 
| Message-ID: | 20030813025052.GH12037@gwolf.cx | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-es-ayuda | 
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(at)gwolf(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Guillermo Schulman | 2003-08-13 12:42:21 | [Pgsql-ayuda] Tablas temporales | 
| Previous Message | Alvaro Herrera Munoz | 2003-08-12 23:46:15 | Re: [Pgsql-ayuda] select CAST(text '123.456.789' as int8) AS valor_sin_puntos; |