Professional Documents
Culture Documents
Table created.
1 row created.
prathees-->ed;
Wrote file afiedt.buf
1 row created.
prathees-->ed
Wrote file afiedt.buf
1 row created.
prathees-->ed
Wrote file afiedt.buf
1 row created.
Write a PL/SQL cursor program to display all the record available in the bank.
declare
cursor drk is select * from bank;
tacno bank.acno%type;
tname bank.name%type;
taddress bank.address%type;
tamount bank.amount%type;
begin
open drk;
loop
fetch drk into tacno,tname,taddress,tamount;
exit when drk%notfound;
dbms_output.put_line('*******************');
dbms_output.put_line('account no:' ||tacno);
dbms_output.put_line('name:' ||tname);
dbms_output.put_line('address:' ||taddress);
dbms_output.put_line('amount:' ||tamount);
end loop;
close drk;
end;
*******************
account no:12345
name:prathees
address:north street
amount:1000
*******************
account no:23456
name:hari
address:south street
amount:2000
*******************
account no:34567
name:nachiar
address:west street
amount:3000
*******************
account no:45678
name:ram
address:east street
amount:5000
Table created.
1 row created.
prathees-->ed
Wrote file afiedt.buf
1* insert into mark values('23spca057','satheesh',65,70,87,89,'vnr')
prathees-->/
1 row created.
prathees--> ed
Wrote file afiedt.buf
1 row created.
prathees-->ed
Wrote file afiedt.buf
1 row created.
prathees-->ed
Wrote file afiedt.buf
1 row created.
prathees-->commit;
Commit complete.
declare
cursor drk is select * from mark;
tregno mark.regno%type;
tname mark.name%type;
tdbms mark.dbms%type;
tse mark.se%type;
toracle mark.oracle%type;
tpython mark.python%type;
tcity mark.city%type;
tot number;
average float;
begin
open drk;
loop
fetch drk into tregno,tname,tdbms,tse,toracle,tpython,tcity;
exit when drk%notfound;
tot:=tdbms+tse+toracle+tpython;
average:=tot/4;
dbms_output.put_line('*******************');
dbms_output.put_line('reg no:' ||tregno);
dbms_output.put_line('name:' ||tname);
dbms_output.put_line('dbms:' ||tdbms);
dbms_output.put_line('software engineering:' ||tse);
dbms_output.put_line('oracle:' ||toracle);
dbms_output.put_line('python:' ||tpython);
dbms_output.put_line('city:' ||tcity);
dbms_output.put_line('total:' ||tot);
dbms_output.put_line('average:' ||average);
end loop;
close drk;
end;
*******************
reg no:23spca056
name:prathees
dbms:60
software engineering:70
oracle:80
python:78
city:sattur
total:288
average:72
*******************
reg no:23spca057
name:satheesh
dbms:65
software engineering:70
oracle:87
python:89
city:vnr
total:311
average:77.75
*******************
reg no:23spca051
name:ragul
dbms:80
software engineering:80
oracle:98
python:90
city:vnr
total:348
average:87
*******************
reg no:23spca034
name:prasana
dbms:69
software engineering:70
oracle:69
python:80
city:vnr
total:288
average:72
*******************
reg no:23spca035
name:sakthi
dbms:79
software engineering:80
oracle:79
python:90
city:madurai
total:328
average:82