Re: NO DATA FOUND Exception
От | Fernando Hevia |
---|---|
Тема | Re: NO DATA FOUND Exception |
Дата | |
Msg-id | 053b01c7b80d$2ebb9740$8f01010a@iptel.com.ar обсуждение исходный текст |
Ответ на | Re: NO DATA FOUND Exception ("Bart Degryse" <Bart.Degryse@indicator.be>) |
Список | pgsql-sql |
>>"Fernando Hevia" <fhevia@ip-tel.com.ar> 2007-06-26 16:25 >>> >>How do I refer a specific field of the returned row from outside the >>function? How should I write the query in order to show only fields 1 and 3, for example? >In case you would like to use set returning functions... > >if your function will return records with the same structure as an existing >table >CREATE FUNCTION my_func() RETURNS SETOF my_table AS ... > >if not you have to define the returning type >CREATE TYPE func_row AS ("field1" varchar(10), "field2" integer, "field3" >integer, ...) >CREATE FUNCTION my_func() RETURNS SETOF func_row AS ... > >now you can use your function >SELECT * FROM my_func(); > >or > >SELECT A.field1, A.field2 >FROM my_func() A left join my_func() B on A.field2 = B.field3 >WHERE A.field1 like 'B%'; Exactly what I was looking for. Thanks!!
В списке pgsql-sql по дате отправления: