CREATE OR REPLACE FUNCTION FCOUTPUT_TEST_LEVEL_1(
O_VAR_OUT OUT number)
RETURN varchar2 IS
---
l_ret varchar2(1);
l_error_msg varchar2(3999);
l_var_out number;
---
E_FUNC_RETURN_NOT_SUCCESS EXCEPTION;
C_FUNC_RETURN_NOT_SUCCESS CONSTANT INTEGER := -20003;
PRAGMA EXCEPTION_INIT (E_FUNC_RETURN_NOT_SUCCESS, C_FUNC_RETURN_NOT_SUCCESS);
---
BEGIN
---
/*
note: another test that was done was to replace
"RAISE_APPLICATION_ERROR(C_FUNC_RETURN_NOT_SUCCESS,'FM',NULL);" with "RAISE E_FUNC_RETURN_NOT_SUCCESS",
if you do this, the output values ββare returned with the expected values ββ(that is, empty/null)
*/
dbms_output.put_line('Where = 1');
l_ret := FCOUTPUT_TEST_LEVEL_2(O_VAR_OUT => l_var_out);
---
IF l_ret != 'S' THEN
---
dbms_output.put_line('Where = 1.1');
RAISE_APPLICATION_ERROR(C_FUNC_RETURN_NOT_SUCCESS
,'FM'
,NULL);
---
END IF;
---
dbms_output.put_line('Where = 2');
l_ret := 'U';
---
IF l_ret != 'S' THEN
---
dbms_output.put_line('Where = 2.1');
RAISE_APPLICATION_ERROR(C_FUNC_RETURN_NOT_SUCCESS
,'FM'
,NULL);
---
END IF;
---
dbms_output.put_line('Where = 3');
O_VAR_OUT := l_var_out;
---
RETURN('S');
---
EXCEPTION
WHEN e_func_return_not_success THEN
---
dbms_output.put_line('Where = 9');
RETURN(l_ret);
---
WHEN OTHERS THEN
---
RAISE;
---
END FCOUTPUT_TEST_LEVEL_1;
---