Procedure:
Data manipulating programs can be stored in Oracle Database. These programs are written in PL/SQL. procedures, functions, packages are saved and stored in the database and can be used as building blocks for applications.
when programmes are compiled once and stored in the database, they are called stored procedure.
Example :
1. first create a table.
command: create table user
(
id number(10) primary key,
name varchar2(20)
);
2. Now create a procedure which inserts into the above table:
command: create procedure insertuser
(
id in number,
name in varchar2(20)
)
is
begin
insert into user values(id,name);
end;
/
3. Now call the procedure and insert the values::
command:
begin
insertuser(1,rama);
dbms_output.put_line('inserted successfully');
end;
/
4. To delete the procedure we use following command:
command: drop procedure insertuser;
Data manipulating programs can be stored in Oracle Database. These programs are written in PL/SQL. procedures, functions, packages are saved and stored in the database and can be used as building blocks for applications.
when programmes are compiled once and stored in the database, they are called stored procedure.
Example :
1. first create a table.
command: create table user
(
id number(10) primary key,
name varchar2(20)
);
2. Now create a procedure which inserts into the above table:
command: create procedure insertuser
(
id in number,
name in varchar2(20)
)
is
begin
insert into user values(id,name);
end;
/
3. Now call the procedure and insert the values::
command:
begin
insertuser(1,rama);
dbms_output.put_line('inserted successfully');
end;
/
4. To delete the procedure we use following command:
command: drop procedure insertuser;
No comments:
Post a Comment