oracle - Reading from an write-only(OUT) parameter in pl/sql -


When I tried to write any read-only parameter (IN) of the function, then Oracle complains with an error But there is no such thing, when reading a function (OUT) from the parameter Oracle silently allows it without any error, what is the reason for this behavior ?. The following code is executed without any assignments occurring in the "so" variable:

  The return number of the function fu (an out number) is such a number; So start: = a; - No work here: = 42; Dbms_output.put_line ('HiYA there'); Dbms_output.put_line ('VAlue:' || Such); Return 5; End; / Some number declared; A number: = 6; Start dbms_output.put_line ('before:' || a); Some: Fu (A); Dbms_output.put_line ('After one:' || a); End;  

I have the output given here:

  Before: 6 HiAA there VLU: A: 42  

What happens here because it is an OUT parameter and the INOU parameter is not passed, the value of a function foo has not been passed The OIT parameter a contains the NULL value at the beginning of the process. You line the line a: = 42; :

  SQL & gt; Number of number to create or change function Fu (one out number) is 2 number 3; Start with 4: 5 = a; - There is no work here 6 / * a: = 42; * / 7dbms_output.put_line ('HiYA there'); 8 dbms_output.put_line ('VAlue:' || So); 9 returns 5; 10 end; 11 / Function SQL and GT; 2 Announce some numbers; 3 a number: = 6; 4 start 5 dbms_output.put_line ('before:' || a); 6 Something: Fu (A); 7 dbms_output.put_line ('After one:' || a); 8 end; 9 / Before: 6 HiYA there VAlue: After one: ^ ^ As you can see an OUT parameter effectively "NULLed" at the beginning of the call  

Comments