Procedure in PL/SQL:
· These subprograms do not return a value directly, return can be done by using OUT parameters.
· Procedures are mainly used to perform an Action.
Difference between Procedure and function:
Procedures
|
Functions
|
Procedures
are used to perform
Particular
action.
|
Functions
are used to perform
Calculation.
|
These subprograms do not
Return
a value directly.
|
These
subprograms are a Return
A
value using the RETURN keyword.
|
Syntax:
Syntax Explanation:
A procedure is created
with the CREATE OR REPLACE
PROCEDURE statement.
Declaration Section:
- It is an optional part. The declaration part does not start with DECLARE keyword.
- It contains a declaration of variables, constants, cursors, exceptions....etc.
Executable Section:
- It is a mandatory part.
- The executable part is used to perform the particular designated action or task.
- It is an optional part.
- The executable part is used to perform the particular designated action or task.
Execution Method:
Method 1:
BEGIN
xxdtj_update_emp(1001);
END;
Method 2:
Begin
xxdtj_update_emp (p_ename => 'sana'
p_job => 'ADMIN',
p_mgr
=>
123,
p_sal => 20000
p_deptno =>
20);
End;
Drop Procedure:
Drop Procedure:
Drop procedure procedure_name;
No comments:
Post a Comment