scott.pro_para_inout(p_dname out scott.dept.dname p_loc out scott.dept.locTYPE) dbms_output.put_line(p_dname dbms_output.put_line(p_loc pro_para_inout;
Call
;
Result
When the parameter type is OUT, the value in the original record (v_dept) does not exist. If it is in out, the original record value remains the same.
Of course, you can set it when you use it according to the actual situation. However, if you want to reset the value under certain circumstances, you can do nothing without meeting the conditions. If the original value remains unchanged, it is wrong to write it as OUT.
This is the official explanation of oracle parameter value transfer or reference transfer.
Summary of Subprogram Parameter Modes
Table 8-1 summarizes the characteristics of parameter modes.
Table 8-1 Parameter Modes
| IN |
OUT |
IN OUT |
The default |
Must be specified |
Must be specified |
Passes a value to the subprogram |
Returns a value to the caller |
Passes an initial value to the subprogram and returns an updated value to the caller |
Formal parameter acts like a constant |
Formal parameter acts like an uninitialized variable |
Formal parameter acts like an initialized variable |
Formal parameter cannot be assigned a value |
Formal parameter must be assigned a value |
Formal parameter shocould be assigned a value |
Actual parameter can be a constant, initialized variable, literal, or expression |
Actual parameter must be a variable |
Actual parameter must be a variable |
Actual parameter is passed by reference (the caller passes the subprogram a pointer to the value) |
Actual parameter is passed by value (the subprogram passes the caller a copy of the value) unlessNOCOPYIs specified |
Actual parameter is passed by value (the caller passes the subprogram a copy of the value and the subprogram passes the caller a copy of the value) unlessNOCOPYIs specified |