Difference between Actual and Formal Parameters in PL/SQL
What is PL/SQL?
PL/SQL is a structured language that is a combination of both SQL and procedural language. Code is written in block format, and this block is passed to the Oracle engine, where it runs and produces the output.
With the help of PL/SQL, we can solve many SQL queries at once using the block. In PL/SQL, there is its own exception handling block, and it can be run on any system or hardware where the Oracle engine is available. It is the basically an extended version of SQL, which is mostly used to create applications. The basic unit of PL/SQL is a block where the block is capable of doing any specific task.
The purpose of using the PL/SQL is that it reduces the traffic from the Oracle engine and increases the speed by passing multiple SQL statements at a time. It is better than SQL because SQL does not provide the features of error checking, but PL.SQL provides.PL/SQL block can be used many times once it is defined. It has many identifiers like variables, constants, procedures etc.
Parameters in PL/SQL
The parameter is a set of variables that are passed into a function or procedure or returned by the procedure. It is also known as an argument to the function. The number of parameters and the use of these parameters in a procedure depend on the programmer.
There are three ways to use the Parameters in PL/SQL:
1. IN Mode
This is the default mode where a constant value is passed into the function or sub-program from the place from where it is being called.
2. OUT Mode
In this mode, a value or parameter is passed from the sub-program to the calling environment.
3. IN OUT Mode
It is the combination of the above modes. There are values passed from the calling place or environment to the subprogram as well as from the subprogram to the calling environment.
Types of Parameters in PL/SQL
The values or expressions which are entered through a function call are known as actual parameters. There is no need to define the data type of these parameters, and they are referenced from the subprogram.
FUNCTION CREATED. SQL>|
Formal parameters are those variables or expressions that are used in the subprogram, and it is necessary to define the data type of these variables. They are scoped to the definition of the subprogram, and outside of this subprogram.
sum of the numbers thrugh the functions is: 69 SQL>|
Difference between Actual and Formal Parameters