Oracle-function exercise, oracle-function
/** Scm_iss.test_imti_fun2 * Function with input parameters */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 with input and output parameters */create or replace function TEST_IMTI_FUN3 (P_NO in number, P_NAME OUT VARCHAR2) RETURN VARCHAR2 ISBEGIN -- call the Stored Procedure SCM_ISS.TEST_IMTI_PRO3 (P_NO, P_NAME); RETURN P_NAME; END; -- Test Call DECLAREA VARCHAR2 (200 ); -- accept output parameter B VARCHAR2 (200); begin B: = scm_iss.TEST_IMTI_FUN3 (1005, A); dbms_output.put_line ('B value:' | B); dbms_output.put_line ('a value: '| A); END;