REF 动态SQL游标


declare
tb_count number;
tb_datatype varchar2(100);
type refcur_finding is ref cursor;--ref 动态游标创建
refcur refcur_finding;
codevalue varchar2(100);
begin
tb_datatype := '财险';

/*验证是否在信息集范围内*/
dbms_output.put_line('===★★★★★★=====验证非空字段中是从数据字典中取数的字段【开始】=====★★★★★★====');
--员工基本信息集【性别】字段数据字典信息校验
open refcur for --为查询的SQL动态打开游标
select C_GENDER from (
select C_GENDER from tb_inf_employee group by C_GENDER
) a left join (
select c_Code from tb_sys_codeitem where c_typecode = 'CODE_GenderType'
) b
on a.c_gender = b.c_code where b.c_code is null;
loop
fetch refcur into codevalue;
exit when refcur%notfound;
dbms_output.put_line('01 【员工基本信息集】中【性别】信息与数据字典信息比较后,发现多出【'||codevalue||'】');
end loop;
dbms_output.put_line('-------员工基本信息集【性别】字段校验完成---------');
--select t.rowid,t.c_gender,t.c_oid from tb_inf_employee t where t.c_gender is null ;

dbms_output.put_line('===★★★★★★=====验证非空字段中是从数据字典中取数的字段【结束】=====★★★★★★====');
dbms_output.put_line(tb_datatype||'--数据验证结束');
end;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值