注册

存储过程里面如何使用游标

随心 2022/09/01 1841 4

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm7
【操作系统】:Windows
【CPU】:
【问题描述】*:
if(acode != ‘43’ and acode != ‘56’ and acode != ‘61’ and acode != ‘73’ and acode != ‘82’
and acode != ‘86’ and acode != ‘92’ and acode != ‘172’ and acode != ‘195’ and acode != ‘269’ and acode != ‘272’) then
DECLARE InsertCursor cursor;
begin
open InsertCursor;
–声明一个游标,用于查询enty_info表的数据
select establish_date,etps_id,reg_no,name,sub_obj_id
from pdgxk.enty_info
where enty_type = ‘1’ and reg_address like (‘%’||aname||‘%’);
end;
else if acode = ‘43’ then
DECLARE InsertCursor cursor ;
begin
open InsertCursor;
–声明一个游标,用于查询enty_info表的数据
select * from tmp3;
end;
else if acode = ‘56’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp4;
end;
else if acode = ‘61’ then
DECLARE InsertCursor cursor;–声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp5;
end;
else if acode = ‘73’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp6;
end;
else if acode = ‘82’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp7;
end;
else if acode = ‘86’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp8;
end;
else if acode = ‘92’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp;
end;
else if acode = ‘172’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp1;
end;
else if acode = ‘195’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp2;
end;
else if acode = ‘269’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp9;
end;
else if acode = ‘272’ then
DECLARE InsertCursor cursor; --声明一个游标,用于查询enty_info表的数据
begin
open InsertCursor;
select * from tmp10;
end;
*/

大概就是这样的结构正常都是放在as下面那一行不过这个有条件放不上去求解

回答 0
暂无回答
扫一扫
联系客服