这是我使用的执行声明:
perform * from table1;
但是当我执行该功能时,不会将表显示在终端上。没有产生错误,表格没有显示出来。
我的功能:
CREATE OR replace FUNCTION addToTable (number INTEGER,NAME VARCHAR(15))
RETURNS void AS $$
BEGIN
INSERT INTO table1
VALUES (
number
,NAME
);
perform *
FROM table1;
END;$$
LANGUAGE plpgsql;
答案 0 :(得分:0)
CREATE OR replace FUNCTION addToTable_1 (num INTEGER,nam VARCHAR(15))
RETURNS setof table11 AS $$
BEGIN
EXECUTE format( 'insert into table11 values(%s,%s) ',num,quote_literal(nam));
RETURN QUERY
EXECUTE 'select * from table11';
END;$$
LANGUAGE plpgsql;
称之为:select * from addToTable_1(2,'User')