From: | "Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)ar> |
---|---|
To: | "'Bart Degryse'" <Bart(dot)Degryse(at)indicator(dot)be>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: NO DATA FOUND Exception |
Date: | 2007-06-26 16:15:16 |
Message-ID: | 053b01c7b80d$2ebb9740$8f01010a@iptel.com.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice pgsql-sql |
>>"Fernando Hevia" <fhevia(at)ip-tel(dot)com(dot)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!!
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2007-06-26 16:18:08 | Re: Rule vs Trigger |
Previous Message | Albe Laurenz | 2007-06-26 15:46:02 | Re: Rule vs Trigger |
From | Date | Subject | |
---|---|---|---|
Next Message | Phillip Nelson | 2007-06-26 16:39:22 | Insert Question |
Previous Message | Bart Degryse | 2007-06-26 14:36:59 | Re: NO DATA FOUND Exception |
From | Date | Subject | |
---|---|---|---|
Next Message | Wei Weng | 2007-06-26 17:04:14 | Re: Vacation days |
Previous Message | news.gmane.org | 2007-06-26 15:22:26 | Re: Where clause |