From: | Roberto Rezende de Assis <rezende_assis(at)yahoo(dot)com(dot)br> |
---|---|
To: | Postgesql list <pgsql-novice(at)postgresql(dot)org> |
Subject: | function returning record |
Date: | 2005-05-05 12:34:16 |
Message-ID: | 427A12C8.1020806@yahoo.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
pglista=# CREATE OR REPLACE FUNCTION teste(int,float)
pglista-# RETURNS record AS '
pglista'# DECLARE
pglista'# numero ALIAS FOR $1;
pglista'# margem ALIAS FOR $2;
pglista'# retorno record;
pglista'# BEGIN
pglista'# retorno.ponto := numero;
pglista'# retorno.percentual := numero*margem;
pglista'# RETURN retorno;
pglista'# END;
pglista'# ' LANGUAGE plpgsql;
CREATE FUNCTION
pglista=# SELECT teste(100,0.1);
ERROR: record "retorno" is not assigned yet
DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
CONTEXT: PL/pgSQL function "teste" line 6 at assignment
pglista=# SELECT ponto,percentual FROM teste(100,0.1);
ERROR: a column definition list is required for functions returning
"record"
Someone knows if it possible to return a record without creating a type
for it, or how to make that definition list that the error message show me.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Schonefeld | 2005-05-05 13:12:28 | ERROR: relation "mytable" does not exist |
Previous Message | Greg Sabino Mullane | 2005-05-04 23:34:06 | Re: connect from perl: error in Carp.pm |