Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I m giving Source, Destination and Age. Write a procedure or
function, it will give to u this source to destination
tickets are available or not, if available then check this
person is senior citizen or not,if this person is senior
citizen then give some discount.
PLZ give this answer......
Thanks advance.....

Answer Posted / aritra

TRY THIS ONE ...

CREATE TABLE FARE_DETAILS
( SOURCE VARCHAR2(100),
DESTINATION VARCHAR2(100),
FARES NUMBER(10,2));


create or replace procedure PROC_TCKT_RESERVATION
(m_source IN VARCHAR2,
m_destination IN VARCHAR2,
m_age IN NUMBER
)
is
v_source FARE_DETAILS.SOURCE%TYPE;
v_destination FARE_DETAILS.DESTINATION%TYPE;
v_fares FARE_DETAILS.FARES%TYPE;
v_fares_out FARE_DETAILS.FARES%TYPE;
begin
IF m_source= m_destination THEN
RAISE_APPLICATION_ERROR(-20001,'SOURCE, DESTINATION
SHOULD NOT BE SAME');
END IF;
SELECT FARES
INTO v_fares
FROM FARE_DETAILS
WHERE SOURCE= m_source
AND DESTINATION= m_destination ;
IF m_age>=60 THEN
v_fares_out:= (v_fares-v_fares*0.3);
DBMS_OUTPUT.PUT_LINE('GIVEN AGE IS FOR SENIOR CITIZEN,
FARE IS '||v_fares_out);
ELSE
v_fares_out:= v_fares;
DBMS_OUTPUT.PUT_LINE(' FARE IS '||v_fares_out);
END IF;

EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20001,'NO DATA FOUND ..ENTER
COREECT SOURCE/DESTINATION');

end PROC_TCKT_RESERVATION;

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between nchar and nvarchar?

956


How to return an array from java to pl/sql?

1061


What is consistency?

1061


Is sql a oracle?

914


What is difference between sql function and stored procedure?

942


what are rollup and cube in t-sql? : Transact sql

1047


What is sql*loader and what is it used for?

1045


What is the purpose of normalization?

995


How many types of cursors are available in pl/sql?

1042


What is difference between inner join and cross join?

909


Can a select statement fire a trigger?

1097


what is isam? : Sql dba

951


What is a left inner join?

946


what is the stuff function and how does it differ from the replace function? : Sql dba

989


What is a database event trigger?

1081