我无法正确执行此命令。表的第一列是一个自动递增的整数,所以我希望在第 2 列开始输入数据。当我执行以下操作时:
PREPARE fooplan (text, smallint, smallint, text, date, timestamp with time zone) as
INSERT INTO "table" VALUES($2, $3, $4, $5, $6, $7);
EXECUTE fooplan('Add New Record', 2, 2, 'User', '1999-Jan-08', '04:05:06');
我收到此错误:
SQL error:
ERROR: column "category_id" is of type smallint but expression is of type text
LINE 2: insert into "MOP" values($2, $3, $4, $5, $6, $7);
^
HINT: You will need to rewrite or cast the expression.
In statement:
prepare fooplan (text, smallint, smallint, text, date, time without time zone) as
insert into "MOP" values($2, $3, $4, $5, $6, $7);
execute fooplan('Add New Mop', 2, 2, 'User', '1999-Jan-08', '04:05:06');
谁能帮我理解我做错了什么?