为毛连创建存储过程都报错了,没怎么用过,不知道哪里出问题了
ERROR [42601] [IBM][DB2/NT] SQL0104N An unexpected token "CREATE OR REPLACE" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "".
代码如下
CREATE OR REPLACE PROCEDURE queryfault (
IN IN_CLASS VARCHAR(150),
IN IN_FAULT CHARACTER(150)
)
result sets 1
LANGUAGE SQL
CALLED ON NULL INPUT
MODIFIES SQL DATA
BEGIN
declare id integer;
FOR V AS MYCURSOR CURSOR FOR
select id,name,type,SIMILARITY(in_class, name) f from (
select id,name,'t1' type from Lib_knowtype where deleted=0 and isopen=3200
union all
select id,name,'d1' type from Def_classify where deleted=0
union all
select id,name,'d2' type from Def_classitem where deleted=0) t order by f desc
DO
set id=v.id;
if v.f>=10 then
FOR V2 AS MYCURSOR CURSOR FOR
WITH RPL (parentid, id, name) AS
(
SELECT ROOT.parentid, ROOT.id, ROOT.name FROM Lib_knowtype ROOT where ROOT.ISOPEN=3200 and ROOT.id=id
UNION ALL
SELECT CHILD.parentid, CHILD.id, CHILD.name FROM RPL PARENT, Lib_knowtype CHILD WHERE PARENT.id= CHILD.parentid
)
select RPL.id, RPL.name from RPL
do
cur:begin
DECLARE missionlist_list CURSOR WITH RETURN TO CALLER for
select id,title from Lib_knowtopic where deleted=0 and status=201001 and typeid=V2.id;
open cursor1;
end cur;
end for;
end if;
END FOR;
END;
https://www.cnblogs.com/janehlp/p/7223460.html
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。