我目前正在postgresql 9.04中编写一个函数,试图在select语句中使用一个变量,然后返回结果.
我提出的声明简单有效;但是,所有列都输出到单个列,而不是多个列.
以下是我的功能:
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
当前输出如下所示:
"(6,"test project","inbound","inbound test","processing")"
如何使结果不串联在一起并分别返回每个列项?
提前谢谢你.