Subroutine introduction:
•NamedPL/SQLBlock,Acceptable parameters,Can be called. •Subroutine type
Process:Used to perform an operation
Function:Used to execute an operation and return values
•Standard-basedPL/SQLBlock Structure
Declaration
Executable part
Exception section (optional)
Advantages:
-Modular
Program decomposition into multiple logic modules
-Reusability
After a subroutine is executed,Stored in Database,Can be in any number
Used in applications
-Maintainability
Subroutine simplifies Maintenance
-Improve Performance
The user directly uses the parsed program in the Shared Pool
Stored Procedure:
• Named PL/SQL Block • Acceptable parameters • Can be called repeatedly • Used to perform an operation • Stored in the database
Formal parameters and actual parameters
Formal parameters: variables declared in the parameter list of the subroutine description
CREATEPROCEDURE raise_sal (
P_idNUMBER, p_amount NUMBER)
...
ENDraise_sal;
•Actual parameters:Variable or expression referenced in the parameter list called by the subroutine
Raise_sal (v_id, 2000)
Create a process with Parameters