We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Exp.No:l3 INSERT AND DELETING A RECORD
PL SQL CODE:
Insert into customers values(1,’Ramesh’,23,”Allhabad’, 30000);
Row inserted,
Insert into customers values(2,’Suresh’,22,’Kanpur’, 2320000);
Row inserted,
Insert into customers values(3,’Mahesh’,24,’Kaja’, 34000);
Row inserted.
Insert into customers values(4,’Chendan’ 25,’Noida’, 38000);
Row inserted.
Insert into customers values(S, Alex’,21,"Paris’, 40000);
Row inserted.
1) TO INSERT
SQL> declare
2 begin
3 insert into customers values(,’Manvith’,20,
4 end;
si
farkapur’,50000);,
OUTPUT:
Old salary
New sala-y- 50000
Salary dil lerence
PL/SQL p-ocedure successfully completed
SOL> selecl "from custoners;
1D MANE AGE ADDRESS
1 ramets 23 alll
2 suresh 22 kenvur
3 mahesh
4 chandan
5 alex 21 paris
1 Nanvith 20 Nerkapur
6 rons selected.2) TO DELETE
SQL> declare
2 begin
3 delete customers where name ~Manvith';
4 end;
si
OUTPUT:
PL/SQL procedure successlully completed.
Neste AGE ADDRESS SALARY
raves : 23 clhabad
suresh 22 kampur
mahech 2a kaja
chandan 25 noida
alex 21 paris 42000
56Exp.No:14 RETRIEVE A RECORD FROM A
TABLE
PL/SQL CODE
SQL> create table e1 (name varchar(10),id int,salary varchar(10),city varchar(10)); Table created.
SQL> insert into e1 values(‘arun’,129,'2000' chennai’);
1 row created,
SQL> insert into e1 values('bala’,236,'4000' ‘ero
1 row created.
SQL> declare
2 ename el name%type;
3 eid el id%type;
4 sal el.salary%etype;
5 ecity el.city%type;
6 begin
select name,id.salary,city into ename,eid,esal,ecity from el where name like 'arun,
8 dbms_output.put_fine(‘name'j'id'j'sal'fcity’;
9 dbms_output.put_line(ename|"jeid)"Jesall!"ecity);
10 end;
PL/SQL procedure successfully completed,
SQL> set serveroutput on;
SQL>/
Name id sal city
Arun 129 2000 chennai
PL/SQL procedure successfully completed.
57