PL/SQL Procedure


1-->create a table
------------------------------------------------------------------------------------------------
create table employee(name varchar2(20),sal number(10),exp number(5));


2-->create a procedure to insert element into the employee table
-------------------------------------------------------------------------------------------------
create or replace procedure insert_value(a in varchar2,b in number,e in number)
is
begin
insert into employee values(a,b,e);
end;
/

3-->call the procedure to insert the records into your table
-------------------------------------------------------------------------------------------------------
declare 
a varchar2(10);
b number(10);
e number(10);
begin
a:='&a';
b:='&b';
e:='&e';
insert_value(a,b,e);
end;
/


Now after insertion, check once records are inserted or not
--------------------------------------------------------------------------
select * from employee;



Explanation
--------------------------------------------------------------
section 2))
in is a parameter (a in varchar2) that shows that the procedure is going to accept the value a ,b and e
in the time of calling,, a is the variable that is going to be passed to the procedure from the calling program.

section 3))
declare is a keyword which shows the declaration session.a,b,e variables are declared with their types.
After declaration session,its begin keyword,that means declaration is over and code starts.
'&variable' it shows the user input in plsql at runtime.then finally function call.And then end;


Comments

Popular posts from this blog

Git Commands With Output Log

Java Interview Preparation (conceptual)

Java 8 Function Interface