/*
*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 IS
BEGIN
--调用输入输出参数的存储过程
SCM_ISS.TEST_IMTI_PRO3(P_NO,P_NAME);
RETURN P_NAME;
END;
--测试调用
DECLARE
A 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;