rtc project in table format

select * from ticketheader ;

FLEET_ID TICKET_NO DOI DOT
---------- ---------- --------- ---------
1 1 10-APR-96 10-MAY-96
2 2 12-APR-96 05-MAY-96
3 3 21-APR-96 15-MAY-96
4 4 25-APR-96 25-MAY-96
5 5 30-APR-96 22-MAY-96

using exception using rtc

declare
fleet number(3);
d date;
route number(4);
code number(4);
e number(4):=&e;
cantravel exception;
cantravel1 exception;
cantravel2 exception;
begin
select fleet_id,day,route_id,cat_code into fleet,d,route,code from fleet_header where fleet_id=e;
if d='24-jun-96' then
raise cantravel;
elsif d='20-apr-96' then
raise cantravel1;
elsif d='25-jun-96' then
raise cantravel;
end if;
exception when cantravel then
dbms_output.put_line(d);
when cantravel1 then
dbms_output.put_line(d);
when cantravel2 then
dbms_output.put_line(d);
end;
/

rtc using exception

declare
origin1 varchar2(10);
ticketno number(4);
e1 number(10):=&e1;
chen exception;
ban exception;
begin
select origin,ticket_no into origin1,ticketno from tick_header where ticket_no =e1;
if origin1='chennai' then
raise chen;
elsif origin1='banglore' then
raise ban;
end if;
exception
when chen then
dbms_output.put_line(origin1||' '||ticketno);
when ban then
dbms_output.put_line(origin1||' '||ticketno);
end;
/
Template Design by faris vio