-
DECLARE
-
l_1 NUMBER := 10;
-
l_2 NUMBER := 20;
-
l_3 NUMBER := 30;
-
PROCEDURE test_out
-
(
-
p1 IN NUMBER
-
,x1 IN OUT NUMBER
-
,x2 IN OUT NOCOPY NUMBER
-
) IS
-
BEGIN
-
x1 := p1;
-
dbms_output.put_line('inside test_out, x1=' || x1);
-
x2 := p1;
-
dbms_output.put_line('inside test_out, x2=' || x2);
-
raise_application_error(-20001, 'test NOCOPY');
-
END;
-
BEGIN
-
dbms_output.put_line('before, l_1=' || l_1 || ', l_2=' || l_2 ||
-
', l_3=' || l_3);
-
BEGIN
-
--the OUT parameter has no value at all until the program terminates successfully,
-
--unless you have requested use of the NOCOPY hint
-
test_out(l_1, l_2, l_3);
-
EXCEPTION
-
WHEN OTHERS THEN
-
dbms_output.put_line('SQLCODE => ' || SQLCODE || ', SQLERRM => ' ||
-
SQLERRM);
-
END;
-
dbms_output.put_line('after, l_1=' || l_1 || ', l_2=' || l_2 || ', l_3=' || l_3);
-
END;
参考
http://www.cnblogs.com/xublogs/archive/2011/06/24/2292198.html
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30201626/viewspace-1813748/
,如需转载,请注明出处,否则将追究法律责任。