Thursday, May 27, 2010

HOTEL BILLING STSTEM

Buzz It
create table hotel(cust_no number(5),cust_name varchar2(10),AC_NON_AC
varchar2(12),room_rent number(5),food_charge number(5),tip number(3),total
number(5));
insert into hotel values(100,'Hasna','AC',25000,1000,100,null);
insert into hotel values(101,'Sithara','NON_AC',5000,200,500,null);
insert into hotel values(102,'Thennal','AC',20000,1500,400,null);
insert into hotel values(103,'Sruthi','AC',23000,400,50,null);
insert into hotel values(104,'Banu','NON_AC',5000,600,30,null);
insert into hotel values(105,'Meher','NON_AC',6000,100,50,null);
declare
cursor c1 is
select*from hotel order by cust_no;
vhot c1%rowtype;
begin
dbms_output.put_line('THE TAJ HOTEL ,CALICUT,KERALA');
dbms_output.put_line('--------------------------------------------');
dbms_output.put_line('cust_no cust_name AC/NON_AC room_rent food_charge tip total');
dbms_output.put_line('----------------------------------------------------------------');
open c1;
loop
fetch c1 into vhot;
exit when c1%notfound;
vhot.total:=vhot.room_rent+vhot.food_charge-vhot.tip;
update hotel set total=vhot.total where vhot.cust_no=cust_no;
dbms_output.put_line('vhot.cust_no,vhot.cust_name,vhot.AC/NON_AC,vhot.room_rent,vho
t.food_charge,vhot.total');
end loop;
close c1;
dbms_output.put_line('----------------------------------------------------------------');
end;
/

OUTPUT

TAJ HOTEL ,CALICUT,KERALA
--------- ---------- ------------ --------- ----------- --------- ------------------- --------- ------------------
CUST_NO CUST_NAME AC_NON_AC ROOM_RENT FOOD_CHARGE TIP TOTAL
--------- ---------- ------------ --------- ----------- --------- -------------------- --------- ---------------
100 Hasna AC 25000 1000 100 25900
101 Sithara NON_AC 5000 200 500 4700
102 Thennal AC 20000 1500 400 21100
103 Sruthi AC 23000 400 50 23350
104 Banu NON_AC 5000 600 30 5570
105 Meher NON_AC 6000 100 50 6050
--------- ---------- ------------

0 comments:

Post a Comment