ORACLE文法-包(package)、預存程序(procedure)、遊標(cursor),oraclecursor

來源:互聯網
上載者:User

ORACLE文法-包(package)、預存程序(procedure)、遊標(cursor),oraclecursor
陳科肇樣本:包規範

CREATE OR REPLACE PACKAGE PACK_WMS_YX IS  -- Author  : CKZ  -- Created : 2015/8/28 9:52:29  -- Purpose : 同步資料  -- Public type declarations,遊標 退休訂單  TYPE retCursor IS REF CURSOR;-- RETURN vi_co_co_return%ROWTYPE;  -- 同步退貨訂單,返回退貨訂單列表集合遊標  PROCEDURE sp_syn_returned(errno OUT NUMBER,errtext OUT VARCHAR2,outCursor OUT retCursor);END PACK_WMS_YX;
包主體
CREATE OR REPLACE PACKAGE BODY PACK_WMS_YX IS  -- Author  : CKZ  -- Created : 2015/8/28 9:52:29  -- Purpose : 同步資料  -- Public variables declarations,執行狀態  v_errorcode wms_sys_sperror.errorcode%TYPE;  v_errormsg wms_sys_sperror.errormsg%TYPE;  v_exception EXCEPTION;--自訂異常  -- 同步退貨訂單  PROCEDURE sp_syn_returned(errno OUT NUMBER,errtext OUT VARCHAR2,outCursor OUT retCursor) IS  BEGIN    errno :=0;    errtext:='success';    --開啟遊標,擷取資料    OPEN outCursor FOR SELECT co_num,cust_code,qty_sum,amt_sum,crt_date,born_date FROM vi_co_co_return;  EXCEPTION--異常    WHEN OTHERS THEN      ROLLBACK;      v_errorcode:=SQLCODE;      v_errormsg:=substr(SQLERRM,200);      errno:=1;      errtext:=v_errormsg;      pack_wms_pub.sp_wms_insertSpErr('同步退貨訂單,返回退貨訂單列表集合遊標',v_errorcode,v_errormsg);  END sp_syn_returned;BEGIN  -- Initialization  NULL;END PACK_WMS_YX;
調用樣本

選中要測試的預存程序名,右鍵->Test
將看到這個頁面

執行Start debugger,Run

查看遊標資料

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.