Re: NO DATA FOUND Exception - Mailing list pgsql-sql

From Fernando Hevia
Subject Re: NO DATA FOUND Exception
Date
Msg-id 053b01c7b80d$2ebb9740$8f01010a@iptel.com.ar
Whole thread Raw
In response to Re: NO DATA FOUND Exception  ("Bart Degryse" <Bart.Degryse@indicator.be>)
List 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 by date:

Previous
From: "Bart Degryse"
Date:
Subject: Re: NO DATA FOUND Exception
Next
From: Wei Weng
Date:
Subject: Re: Vacation days