oracle-function 練習,oracle-function

來源:互聯網
上載者:User

oracle-function 練習,oracle-function

/**scm_iss.test_imti_fun2*帶有輸入參數的Function*/CREATE OR REPLACE FUNCTION TEST_IMTI_FUN2(P_NO IN NUMBER) RETURN VARCHAR2 IS  P_IMTI_NAME VARCHAR2(200);  P_IMTI_DESC VARCHAR2(200);  P_RETURN    VARCHAR2(200);BEGIN  --SELECT I.IMTI_NAME INTO P_IMTI_NAME FROM SCM_ISS.T_IMTI_TEST I WHERE I.IMTI_NO = P_NO;  SELECT I.IMTI_DESC, I.IMTI_NAME    INTO P_IMTI_DESC, P_IMTI_NAME    FROM SCM_ISS.T_IMTI_TEST I   WHERE I.IMTI_NO = P_NO;  --P_IMTI_DESC := P_IMTI_NAME;  P_RETURN := P_IMTI_NAME || ':' || P_IMTI_DESC;  RETURN P_RETURN;EXCEPTION  WHEN OTHERS THEN    DBMS_OUTPUT.PUT_LINE('EXCEPTION:'||SQLERRM);END TEST_IMTI_FUN2;/**scm_iss.test_imti_fun3*帶有輸入輸出參數的Function*/CREATE OR REPLACE FUNCTION TEST_IMTI_FUN3(P_NO IN NUMBER ,P_NAME OUT VARCHAR2) RETURN VARCHAR2 ISBEGIN--調用輸入輸出參數的預存程序SCM_ISS.TEST_IMTI_PRO3(P_NO,P_NAME);RETURN P_NAME;END;--測試調用DECLAREA VARCHAR2(200); --接受輸出參數B VARCHAR2(200);BEGIN  B := scm_iss.TEST_IMTI_FUN3(1005,A);  dbms_output.put_line( 'B 值:' || B );    dbms_output.put_line( 'A 值:' || A);  END;


 

相關文章

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.