【发布时间】:2020-10-22 13:56:39
【问题描述】:
我有一个表类型 newIntList
CREATE TYPE newIntList AS
(
id bigint
);
想在类型变量中插入一个整数值。
试过下面的代码,不工作....
CREATE OR REPLACE FUNCTION insertintoType(n1 integer)
RETURNS table(id integer) AS $$
declare
list newIntList[];
BEGIN
insert into list
select n1; //looking for a code for inserting into Type "**newIntList**"
return query
select unnest(list );
END; $$
LANGUAGE PLPGSQL;
请帮忙
【问题讨论】:
-
该类型在您的示例中似乎完全没用。
标签: types insert postgresql-9.4