av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

Oracle通過其實際存儲過程中返回相關(guān)數(shù)據(jù)集

以下的文章主要介紹的是Oracle通過存儲過程中返回相關(guān)數(shù)據(jù)集的實際操作方案,我們首先要了解的是如何正確的使用存儲過程來返回數(shù)據(jù)集,我們大家都知道Oracle數(shù)據(jù)庫中的存儲過程返回數(shù)據(jù)集是Oracle通過ref cursor類型數(shù)據(jù)的參數(shù)返回的。

而返回數(shù)據(jù)的參數(shù)應該是out或in out類型的,由于在定義存儲過程時無法直接指定參數(shù)的數(shù)據(jù)類型為:ref cursor,而是首先Oracle通過以下方法將ref cursor進行了重定義:

 
 
 
  1. create or replace package FuxjPackage is
  2. type FuxjResultSet is ref cursor;

還可以定義其他內(nèi)容

 
 
 
  1. end FuxjPackage;

再定義存儲過程:

 
 
 
  1. create or replace procedure UpdatefuxjExample (sDM in char,sMC in char, pRecCur in out FuxjPackage.FuxjResultSet)
  2. as
  3. begin
  4. update fuxjExample set mc=sMC where dm=sDM;
  5. if SQL%ROWCOUNT=0 then
  6. rollback;
  7. open pRecCur for
  8. select '0' res from dual;
  9. else
  10. commit;
  11. open pRecCur for
  12. select '1' res from dual;
  13. end if;
  14. end;

 
 
 
  1. create or replace procedure InsertfuxjExample 
    (sDM in char,sMC in char, pRecCur in out FuxjPackage.FuxjResultSet)
  2. as
  3. begin
  4. insert into FuxjExample (dm,mc) values (sDM,sMC);
  5. commit;
  6. open pRecCur for
  7. select * from FuxjExample;
  8. end;

在Delphi中調(diào)用返回數(shù)據(jù)集的存儲過程

可以通過TstoredProc或TQuery控件來調(diào)用執(zhí)行返回數(shù)據(jù)集的存儲,數(shù)據(jù)集Oracle通過TstoredProc或TQuery控件的參數(shù)返回,注意參數(shù)的DataType類型為ftCursor,而參數(shù)的ParamType類型為ptInputOutput。

使用TstoredProc執(zhí)行UpdatefuxjExample的相關(guān)設置為:

 
 
 
  1. object StoredProc1: TStoredProc
  2. DatabaseName = 'UseProc'
  3. StoredProcName = 'UPDATEFUXJEXAMPLE'
  4. ParamData = <
  5. item
  6. DataType = ftString
  7. Name = 'sDM'
  8. ParamType = ptInput
  9. end
  10. item
  11. DataType = ftString
  12. Name = 'sMC'
  13. ParamType = ptInput
  14. end
  15. item
  16. DataType = ftCursor
  17. Name = 'pRecCur'
  18. ParamType = ptInputOutput
  19. Value = Null
  20. end>
  21. end 

上述的相關(guān)內(nèi)容就是對Oracle通過存儲過程中返回數(shù)據(jù)集的描述,希望會給你帶來一些幫助在此方面。


標題名稱:Oracle通過其實際存儲過程中返回相關(guān)數(shù)據(jù)集
分享URL:http://uogjgqi.cn/article/coosped.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流