davyberroho
asked on
return type of PostgreSQL function when joining 2 tables
Hello,
I'm trying to create a new postgresql function (stored procedure) and I would like to know which return type I've to use in the following query :
select *
from table1 t1,table2 t2
where t1.pid = t2.pid
I cannot use the return type table1 because the query also returns table2-values.
I've already tried this : RETURNS SETOF "anyelement". But it doesn't work.
Thanks ...
Davy (Belgium)
I'm trying to create a new postgresql function (stored procedure) and I would like to know which return type I've to use in the following query :
select *
from table1 t1,table2 t2
where t1.pid = t2.pid
I cannot use the return type table1 because the query also returns table2-values.
I've already tried this : RETURNS SETOF "anyelement". But it doesn't work.
Thanks ...
Davy (Belgium)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT * from my_function(argument) (int field1, text field2, timestamp filed3....) (just an example, look in the manual for syntax and usage info).
Robson.