InterviewSolution
| 1. |
What are the modes of parameters in PL/SQL? |
|
Answer» The MODES of parameters in a PL/SQL subprogram includes the following:
The IN parameter is a read-only parameter that allows you to PASS a value to the subprogram. It acts as a constant in the subprogram. A constant, LITERAL, initialized variable, or expression can be PASSED as an IN parameter.
The OUT parameter acts like a variable in a subprogram. Its value can be changed unlike the IN parameter.The value can be reference after assignment.
The actual parameter is passed by value. The initial value is passed to a subprogram. The updated value is returned to the caller. Let us see an example: DECLARE val number; PROCEDURE display(n IN OUT number) IS BEGIN n := n * n; END; BEGIN val:= 42; display(val); dbms_output.put_line('Square of 42 = ' || val); END; /The output: Square of 42 = 1764 |
|