CREATE OR REPLACE PROCEDURE gwbs_check(vpcbh in t_batch_gwbs_check.pcbh%type) IS
CURSOR c_tocheck IS
SELECT * FROM t_batch_gwbs_check c where c.pcbh=vpcbh;--获取待校验的数据
errorStr varchar2(500);--来拼接每条数据的错误提示
gw_rows number;
police_rows number;
cxfs_rows number;
cph_rows number;
qwms_rows number;
police_deploy_rows number;
police_leave_rows number;
todeploy_timeerror_rows number;
real_qssjd t_batch_gwbs_check.qssj_d%type;
real_jssjd t_batch_gwbs_check.jssj_d%type;
qssjd t_gwxx_gwsd.qssj%type;
jssjd t_gwxx_gwsd.jssj%type;
gwsd_rows number;
BEGIN
DBMS_OUTPUT.PUT_LINE('循环开始时间:'||to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
--待校验游标循环
FOR c_tocheck_r IN c_tocheck LOOP
errorStr := '';
/*根据开始结束时间和岗位时段情况来赋值真正的开始时间和结束时间*/
if c_tocheck_r.qssj_d is not null and c_tocheck_r.jssj_d is not null and c_tocheck_r.gwsdid is not null
then
errorStr := concat(errorStr,'起始结束时间和岗位时段必须二选一;');
goto updateTable;
elsif c_tocheck_r.qssj_d is null and c_tocheck_r.jssj_d is null and c_tocheck_r.gwsdid is null
then errorStr := concat(errorStr,'起始结束时间和岗位时段必须二选一;');
goto updateTable;
elsif (c_tocheck_r.qssj_d is null and c_tocheck_r.jssj_d is not null) or (c_tocheck_r.qssj_d is not null and c_tocheck_r.jssj_d is null)
then errorStr := concat(errorStr,'起始时间和结束时间不能只能选一个;');
goto updateTable;
elsif c_tocheck_r.qssj_d is not null and c_tocheck_r.jssj_d is not null and c_tocheck_r.gwsdid is null
then
real_qssjd := c_toc
写过的合理验证oracle存储过程PROCEDUREprocedure
最新推荐文章于 2021-04-04 07:49:45 发布
本文探讨了在Oracle数据库中编写存储过程PROCEDURE的合理验证方法,包括参数检查、异常处理和性能优化等方面,旨在提升存储过程的稳定性和效率。
摘要由CSDN通过智能技术生成