PL/SQL Procedure: How To Pass Parameters in Procedure
PL/SQL Procedure: How To Pass Parameters in Procedure
PL/SQL Procedure: How To Pass Parameters in Procedure
The PL/SQL stored procedure or simply a procedure is a PL/SQL block which performs one or more
specific tasks. It is just like procedures in other programming languages.
o Header: The header contains the name of the procedure and the parameters or variables
passed to the procedure.
o Body: The body contains a declaration section, execution section and exception section similar
to a general PL/SQL block.
00:00/11:48
41.1M
730
Prime Ministers of India | List of Prime Minister of India (1947-2020)
1. CREATE [OR REPLACE] PROCEDURE procedure_name
2. [ (parameter [,parameter]) ]
3. IS
4. [declaration_section]
5. BEGIN
6. executable_section
7. [EXCEPTION
8. exception_section]
9. END [procedure_name];
Table creation:
1. create table user(id number(10) primary key,name varchar2(100));
Procedure Code:
1. create or replace procedure "INSERTUSER"
2. (id IN NUMBER,
3. name IN VARCHAR2)
4. is
5. begin
6. insert into user values(id,name);
7. end;
8. /
Output:
Procedure created.
1. BEGIN
2. insertuser(101,'Rahul');
3. dbms_output.put_line('record inserted successfully');
4. END;
5. /
Now, see the "USER" table, you will see one record is inserted.
ID Name
101 Rahul
PL/SQL Drop Procedure
Syntax for drop procedure
1. DROP PROCEDURE procedure_name;
1. DROP PROCEDURE pro1;