IN OUT Mode
This mode is a mixture of both IN n=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.
Example: The following example illustrates the working of OUT Mode argument –
Query
SQL> CREATE OR REPLACE PROCEDURE PR3(2 OUT NUMBER) AS
A NUMBER:=11;
BEGIN
B:=A+B;
END;
Output
Procedure created.
Query
SQL> DECLARE
R NUMBER:=22;
BEGIN
PR3(R);
DBMS_OUTPUT.PUT_LINE('RESULT IS: '||R);
END;
Output
RESULT IS : 33
PL/SQL procedure successfully completed.
SQL>
Points to remember while working on with Arguments Modes
- To increase maintainability and reuse, divide your code into modular components (procedures, functions, and packages).
- When naming variables, procedures, functions, and packages, be sure to use sensible and consistent conventions.
- Log or appropriately handle exceptions instead than using empty exception blocks.
- When possible, avoid utilizing global variables.
- Utilize the right indexes, stay away from pointless joins, and reduce database round-trips to optimize SQL queries.
- Write your code to describe its function and purpose.
- Maintain the documentation for the code.
- To make sure your PL/SQL code behaves as expected, write unit tests.
- Implement the proper privileges and access controls for database objects.
- To increase efficiency, avoid making unnecessary commits inside of loops.
- Keep a tab on the SQL execution plans and database resources.
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
- IN OUT Mode
Arguments are the values that are passed to the PL/SQL blocks, subprograms, or functions. Arguments allow you to manipulate data in a dynamic manner. Here are some examples of how to use arguments in the PL/SQL language: