有用postsql写过存储过程的没呀?postgres怎么在存储过程取出select的数据呀?
我写了一个
CREATE OR REPLACE FUNCTION "public"."function1" (
)
RETURNS SETOF VARCHAR AS
$body$
DECLARE
 v_index integer;
 v_count integer;
BEGIN
  v_index :=2;
  v_count :=60;
  SELECT split_part("name",'~@~',v_index)
    FROM student  
    order by ID desc
    limit 1;
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER;
然后select * from fucntion1()提示错误:
ERROR:  query has no destination for result data
HINT:  If you want to discard the results of a SELECT, use PERFORM instead.