SQL> CREATE OR REPLACE PROCEDURE ModeOut (p_Out OUT NUMBER) AS
2 v_LocalVariable NUMBER := 0;
3 BEGIN
4 IF (p_Out IS NULL) THEN
5 DBMS_OUTPUT.PUT_LINE('p_Out is NULL');
6 ELSE
7 DBMS_OUTPUT.PUT_LINE('p_Out = ' || p_Out);
8 END IF;
9
10 p_Out := 7;
11
12 v_LocalVariable := p_Out;
13
14 DBMS_OUTPUT.PUT('At end of ModeOut: ');
15 IF (p_Out IS NULL) THEN
16 DBMS_OUTPUT.PUT_LINE('p_Out is NULL');
17 ELSE
18 DBMS_OUTPUT.PUT_LINE('p_Out = ' || p_Out);
19 END IF;
20 END ModeOut;
21 /
Procedure created.
SQL>
SQL>
SQL>
SQL> show errors
No errors.
SQL>
SQL>
SQL> DECLARE
2 v_Out NUMBER := 1;
3 BEGIN
4
5 DBMS_OUTPUT.PUT_LINE('Before calling ModeOut, v_Out = ' || v_Out);
6 ModeOut(v_Out);
7 DBMS_OUTPUT.PUT_LINE('After calling ModeOut, v_Out = ' || v_Out);
8 END;
9 /
Before calling ModeOut, v_Out = 1
p_Out is NULL
At end of ModeOut: p_Out = 7
After calling ModeOut, v_Out = 7
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
|