修改的儲存過程
使用kettle匯入oralce資料表,其中兩個表涉及到了觸發器,同時觸發器還呼叫了儲存過程;以為已經寫好的東西不會有錯誤的,這種盲目相信導致了自己耗費了接近一天的時間!!!引以為戒。
--自己在裡面加了進入loop迴圈的判斷,跳出迴圈以及最後的commit
CREATE OR REPLACE PROCEDURE "TOPICIS"."REALTIMECAUTION2"( V_SIGN VARCHAR2, YWBS NUMBER) AS
ztbs NUMBER;
zch varchar(50);
qymc varchar(200);
zxrq TIMESTAMP;
bgrq TIMESTAMP;
cjr_bs NUMBER;
jg_bs NUMBER;
zgjg_bs NUMBER;
zw_bs NUMBER;
ajbs NUMBER;
--遊標宣告
cursor cursor6 is
select a.ID as ztbs,a.RegNO,a.EntName as qymc, b.RegDate as zxrq, a.PerID,a.OrgID,a.PriOrgID,a.JobID from REG_MarPriPInfo a,REG_MarPriPCancel b,REG_ParentEnt c where a.EntType in ('2100','2200') and b.RegNO = c.RegNO and b.ID=YWBS and a.ID = c.MarPrID;
cursor cursor7 is
select a.ID as ztbs,a.RegNO,a.EntName as qymc, a.EstDate as zxrq,a.PerID,a.OrgID,a.PriOrgID,a.JobID from REG_MarPriPInfo a,REG_MarPriPCancel b,REG_Investor c where b.MarPrID in (select d.ID from REG_MarPriPInfo d where d.RegNO=c.BLicNO) and c.BLicType in('11','12','14','21','22','31','32','33') and b.ID=YWBS and c.Batch ='1' and a.ID = c.MarPrID;
cursor cursor8 is
select a.ID as ztbs,a.RegNO,a.EntName as qymc, b.AccDate as bgrq, a.PerID,a.OrgID,a.PriOrgID,a.JobID from REG_MarPriPInfo a,REG_AltAccInfo b,REG_AltAccItem c,REG_MarPriPInfo d,REG_ParentEnt e where a.EntType in ('2100','2200') and c.AltItem = '110' and b.MarPrID = d.ID and d.RegNO = e.RegNO and b.ID = c.AltAccId and b.ID=YWBS and a.ID = e.MarPrID;
cursor cursor10 is
select a.ID, a.CerNO, a.Name, a.PerID, a.OrgID, a.PriOrgID, a.JobID from LAW_CaseInfo a where a.ID = YWBS;
BEGIN
if(V_SIGN = 'cancel') then
open cursor6;
fetch cursor6 into ztbs,zch,qymc,zxrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
--需要進行控制判斷,如果遊標中沒有資料的話,就不能進行迴圈
while cursor6%found Loop
insert into SIS_CauInfo
(ID,MarPrID,BusiActId,RegNO,EntName,LicNo,WarType,
WarUnit,LimitCorrDate,WarFrom,WarTo,
WarCont,Remark,RegDate,
PerID,OrgID,PriOrgID,JobID,State,FromType,WarState,WarStatus)
values
(SEQ_TOPICMS.nextval,ztbs,null,zch,qymc,'',
'母公司注(吊)銷警示資訊',null,null,zxrq,
null,'母公司注(吊)銷;注(吊)銷時間:' ||to_char(zxrq),null,sysdate,
cjr_bs,jg_bs,coalesce(zgjg_bs, jg_bs),zw_bs,'02','01','1','16');
fetch cursor6 into ztbs,zch,qymc,zxrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
--設定推出迴圈的條件,否則就進入了死迴圈
exit when cursor6%notfound;
end Loop;
close cursor6;
open cursor7;
fetch cursor7 into ztbs,zch,qymc,zxrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
while cursor7%found Loop
insert into SIS_CauInfo
(ID,MarPrID,BusiActId,RegNO,EntName,LicNo,WarType,WarUnit,LimitCorrDate,
WarFrom,WarTo,WarCont,Remark,RegDate,
PerID,OrgID,PriOrgID,JobID,State,FromType,WarState,WarStatus) values
( SEQ_TOPICMS.nextval,ztbs,null,zch,qymc,'','投資公司注(吊)銷警示資訊',null,null,
zxrq,null,'投資公司注(吊)銷;注(吊)銷時間:' ||to_char(zxrq),null,sysdate,
cjr_bs,jg_bs,coalesce(zgjg_bs, jg_bs),zw_bs,'02','01','1','16');
fetch cursor7 into ztbs,zch,qymc,zxrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
exit when cursor7%notfound;
end Loop;
close cursor7;
end if;
--插入母公司變更名稱警示資訊
if(V_SIGN = 'altname') then
open cursor8;
fetch cursor8 into ztbs,zch,qymc,bgrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
while cursor8%found Loop
insert into SIS_CauInfo
(ID,MarPrID,BusiActId,RegNO,EntName,LicNo,WarType,
WarUnit,LimitCorrDate,WarFrom,WarTo,WarCont,
Remark,RegDate,PerID,OrgID,PriOrgID,JobID,State,FromType,WarState,WarStatus)
values
(SEQ_TOPICMS.nextval,ztbs,null,zch,qymc,'', '母公司變更名稱警示資訊',
null,null,bgrq,null,'母公司變更名稱;變更時間:' ||to_char(bgrq),
null,sysdate,cjr_bs,jg_bs,coalesce(zgjg_bs, jg_bs),zw_bs,'02','01','1','30');
fetch cursor8 into ztbs,zch,qymc,bgrq,cjr_bs,jg_bs,zgjg_bs,zw_bs;
exit when cursor8%notfound;
end Loop;
close cursor8;
end if;
--對企業立案後,要加警示
if(V_SIGN = 'setcase') then
open cursor10;
fetch cursor10 into ajbs,zch,qymc,cjr_bs,jg_bs,zgjg_bs,zw_bs;
while cursor10%found Loop
insert into SIS_CauInfo
(ID,MarPrID,BusiActId,RegNO,EntName,LicNo,WarType,WarUnit,LimitCorrDate,
WarFrom,WarTo,WarCont,Remark,RegDate,PerID,OrgID,PriOrgID,
JobID,State,FromType,WarState,WarStatus)
values
(SEQ_TOPICMS.nextval,ajbs,null,zch,qymc,'','企業已經被立案',null,null,
sysdate,null,'企業已經被立案',null,sysdate,cjr_bs,jg_bs,coalesce(zgjg_bs, jg_bs),
zw_bs,'02','01','1','51');
fetch cursor10 into ajbs,zch,qymc,cjr_bs,jg_bs,zgjg_bs,zw_bs;
exit when cursor10%notfound;
end Loop;
close cursor10;
end if;
commit;
END REALTIMECAUTION2;
沒有人可以信賴,只有自己!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28803801/viewspace-768601/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql儲存過程的修改MySql儲存過程
- 修改儲存過程所有者儲存過程
- 從sybase的儲存過程轉向oracle的儲存過程儲存過程Oracle
- MySQL儲存過程詳解 mysql 儲存過程MySql儲存過程
- 儲存過程儲存過程
- 在儲存過程A中呼叫儲存過程B的結果儲存過程
- oracle的儲存過程Oracle儲存過程
- mysql的儲存過程MySql儲存過程
- MySql儲存過程—2、第一個MySql儲存過程的建立MySql儲存過程
- 儲存過程呼叫其他模式的儲存過程需要注意的地方儲存過程模式
- SQL 儲存過程裡呼叫另一個儲存過程SQL儲存過程
- MySQL儲存過程詳解 mysql 儲存過程linkMySql儲存過程
- Oracle儲存過程乾貨(一):儲存過程基礎Oracle儲存過程
- Mysql 的儲存過程和儲存函式MySql儲存過程儲存函式
- 儲存過程與儲存函式儲存過程儲存函式
- Oracle儲存過程Oracle儲存過程
- 使用儲存過程儲存過程
- sybase儲存過程儲存過程
- java儲存過程Java儲存過程
- 管理儲存過程儲存過程
- 呼叫儲存過程儲存過程
- mysql 儲存過程MySql儲存過程
- SQLSERVER儲存過程SQLServer儲存過程
- 儲存過程中巢狀儲存過程的變數執行方式儲存過程巢狀變數
- 實戰儲存過程排程過程儲存過程
- Mysql 儲存過程的使用MySql儲存過程
- Sqlserver中的儲存過程SQLServer儲存過程
- 儲存過程的詳解儲存過程
- oracle的儲存過程格式Oracle儲存過程
- 解密encrypt的儲存過程解密儲存過程
- 把自編儲存過程設定為系統儲存過程儲存過程
- 使用ORACLE 的JAVA儲存過程修改作業系統密碼OracleJava儲存過程作業系統密碼
- 儲存過程 傳 datatable儲存過程
- 儲存過程——遊標儲存過程
- Oracle儲存過程-1Oracle儲存過程
- mysql儲存過程整理MySql儲存過程
- JAVA儲存過程(轉)Java儲存過程
- JdbcTemplate調儲存過程JDBC儲存過程