Difference between Argument Modes in PL/SQL
Argument modes are basically used to describe the behavior of the formal parameters. There are three types of argument modes which are used in the sub program which are as follows : IN Mode, OUT Mode, and IN OUT Mode.
These are explained as following :
- IN Mode :
It is the default argument mode in the subprogram. This mode passes a constant value from the calling environment into the subprogram.
- OUT Mode :
This mode passes a value from the subprogram to the calling environment.
- IN OUT Mode :
This mode is a mixture of both IN and OUT mode. Just like IN mode, it passes a value from the calling environment in subprogram and like a OUT mode, it possibly pass different value from the subprogram back to the calling environment using the same parameter.
Difference between IN, OUT and IN OUT Mode :
|IN Mode||Out Mode||IN OUT Mode|
|It is the default mode.||It must be specified.||It must be specified.|
|In this value is passed into subprogram.||In this value is returned to calling environment.||In this, value is passed into subprogram and also returned to calling environment.|
|In this formal parameter acts as a constant.||In this formal parameter act as un-initialized variable.||In this formal parameter act as initialized variable.|
|In this actual parameter can be a literal, impression, constant or initialized variable.||In this actual parameter must be a variable.||In this actual parameter must be a variable.|
|It can be assigned as a default value.||It cannot be assigned as a default value.||It also cannot be assigned as a default value.|
|It performs read only operation.||It performs only write operation.||It performs both read and write operation.|
Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course by GeeksforGeeks.