db2 自定义函数问题
createfunctionaddtest()returnsintlanguagesqlmodifiessqldatabeginatomicdeclarev_cntint...
create function addtest()
returns int
language sql
modifies sql data
begin atomic
declare v_cnt integer;
declare v_dsj integer;
declare v_wsj integer;
declare v_str varchar(255) default '0';
set v_cnt = 0;
set v_dsj = 1396281600000;
while(v_cnt <= 90)do
set v_dsj = v_dsj + v_cnt*1000*60*60*24;
set v_cnt = v_cnt+1;
set v_wsj = v_dsj + v_cnt * 1000*60*60*24;
set v_str = (select jivemsg_mark.uri from jivemsg_mark where jivemsg_mark.createtime >= v_dsj and jivemsg_mark.createtime <= v_wsj and jivemsg_mark.sender = 'itw_liyx' order by jivemsg_mark.createtime fetch first 1 rows only);
insert into msgtk1(msgtk1.uri) values(v_str);
end while;
return 0;
end
哪里有问题啊,一直提示 modifies sql data 子句的多个关键字或有冲突的关键字 sqlcode -628 展开
returns int
language sql
modifies sql data
begin atomic
declare v_cnt integer;
declare v_dsj integer;
declare v_wsj integer;
declare v_str varchar(255) default '0';
set v_cnt = 0;
set v_dsj = 1396281600000;
while(v_cnt <= 90)do
set v_dsj = v_dsj + v_cnt*1000*60*60*24;
set v_cnt = v_cnt+1;
set v_wsj = v_dsj + v_cnt * 1000*60*60*24;
set v_str = (select jivemsg_mark.uri from jivemsg_mark where jivemsg_mark.createtime >= v_dsj and jivemsg_mark.createtime <= v_wsj and jivemsg_mark.sender = 'itw_liyx' order by jivemsg_mark.createtime fetch first 1 rows only);
insert into msgtk1(msgtk1.uri) values(v_str);
end while;
return 0;
end
哪里有问题啊,一直提示 modifies sql data 子句的多个关键字或有冲突的关键字 sqlcode -628 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询