Oracle之帶參存儲過程(存儲過程中for循環調用存儲過程)


一段業務代碼改編,大概意思是搜索指定時間段內的信息,未詳細說明業務內容,僅供參考幾個參數的位置。

--帶參存儲過程 testdate,參數為v,內部定義參數i
create
or replace procedure testdate(v in number) is i number; begin i:=v; --v賦值給i
select EN_ID,EN_NAME,ASA_CODE,ASA_NAME,AS_YESTERDAY,DATEKEEY from test2table where datekeey = i; commit; end testdate;
--存儲過程中for循環調用存儲過程,testdate2調用testdate
create
or replace procedure testdate2 is Cursor datekeey is
select to_number(to_char(datekeey,'yyyyMMdd')) datekeey from ( select date'2017-01-01' + (rownum - 1) datekeey from dual connect by rownum <= (date'2018-09-18' - date'2017-01-01' + 1) ); --從2017-01-01到2018-09-18遍歷日期 i number; begin for i in datekeey LOOP begin testdate(i.datekeey); --調用testdate存儲過程 end; end LOOP; commit; end testdate2;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM