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 / kavitha nedigunta

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


CREATE OR REPLACE FUNCTION TCKT_RESERVATION_FUN
(
I_SOURCE IN FARE_DETAILS.SOURCE%TYPE,
I_DESTINATION IN FARE_DETAILS.DESTINATION%TYPE,
I_AGE IN FARE_DETAILS.FARES%TYPE
) RETURN VARCHAR2
AS
L_OUT_PUT VARCHAR2(2000) DEFAULT NULL;
L_FARES FARE_DETAILS.FARES%TYPE;
BEGIN

IF UPPER(TRIM(I_SOURCE)) = UPPER(TRIM(I_DESTINATION)) THEN
l_OUT_PUT := 'SOURCE, DESTINATION SHOULD NOT BE SAME';
RETURN l_OUT_PUT;
END IF;

SELECT FARES INTO L_FARES FROM FARE_DETAILS
WHERE UPPER(TRIM(SOURCE)) = UPPER(TRIM(I_SOURCE))
AND UPPER(TRIM(DESTINATION)) = UPPER(TRIM
(I_DESTINATION));

IF I_AGE >=60 THEN
l_OUT_PUT:= (L_FARES-L_FARES*0.3);
ELSE
l_OUT_PUT := L_FARES;
END IF;
RETURN l_OUT_PUT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_OUT_PUT :='NO DATA FOUND ..ENTER COREECT
SOURCE/DESTINATION';
RETURN l_OUT_PUT;
END TCKT_RESERVATION_FUN;

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to calculate the difference between two dates? : Sql dba

991


Explain exception handling in pl/sql?

987


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

925


explain the options of myisamchk to improve the performance of a table. : Sql dba

949


How can we avoid duplicating records in a query?

917


What are crud methods?

969


What program will open a mdb file?

909


What is a behavioral trigger?

925


Explain what is rdbms?

990


How many types of normalization are there?

894


Write a sql query to get the third highest salary of an employee from employee_table?

1026


what are different types of keys in sql?

1063


How can we store rows in PL/SQL using array?

1158


Is left join same as join?

936


Is truncate ddl or dml?

942