以下为db2的自定义函数,报错:
消息: "NEXTVAL FOR DB2INST1.SEQ_SERIAL" cannot be specified in this context.. SQLCODE=-348, SQLSTATE=428F9, DRIVER=3.50.152
请各位大神帮忙看一下,谢谢
CREATE FUNCTION DB2INST1.GETID(pre varchar(100) default 'C')
returns varchar(100)
LANGUAGE SQL
begin ATOMIC
declare myret varchar(100);
set myret=(select '000000000000000000000' || nextval for DB2INST1.seq_serial from SYSIBM.SYSDUMMY1);
set myret = substr(myret,length(myret)-7);
set myret = pre || myret;
return myret;
end
GO
该怎么改呢?
本回答被网友采纳