I am currently writing a function in postgresql 9.04 where I am attempting to use a variable which will be used in a select statement then return the results.
The statement I have come up with is simple and works; however, all the columns are outputing to a single column instead of multiple columns.
here is my function:
create or replace function foo(IN pID integer, OUT project_id integer, OUT project_name text, OUT project_type text, OUT project_description text, OUT project_status text)
returns setof record as
$$
select project_id, project_name, project_type, project_description, project_status from t_projects
where project_id = $1;
$$
LANGUAGE SQL;
select foo(6) -- runs function
the current output looks like this:
"(6,"test project","inbound","inbound test","processing")"
how can I make it so the results are not concatenated together and return each column item seperately?
thank you in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…