Advertisement

02.28.2007 at 06:11PM PST, ID: 22420558
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Help with my del_flight procedure

Asked by urobins in Oracle Database

My del_flight is returning an error can someone help me find out why?  here is my package followed by my tables


create or replace package AIRLINE_MOD as

procedure ADD_RES (aPass_ID IN VARCHAR2, aSSN IN CHAR, aflight_num IN CHAR);

procedure UP_RES (aPass_ID IN VARCHAR2, aflight_num in CHAR);

procedure DEL_RES (aPass_ID IN VARCHAR2);

procedure ADD_FLIGHT (aFlight_num IN CHAR, aairline IN VARCHAR2, adept_date IN DATE, aret_date IN DATE,
adept_time IN CHAR, aret_time IN CHAR, aseats IN CHAR, adestination IN CHAR);

procedure UP_FLIGHT (aFlight_num IN CHAR, aairline IN VARCHAR2, adept_date IN DATE, aret_date IN DATE,
adept_time IN CHAR, aret_time IN CHAR, aseats IN CHAR, adestination IN CHAR);

procedure DEL_FLIGHT (aFlight_num IN CHAR);

END AIRLINE_MOD;
/


create or replace package body AIRLINE_MOD as



procedure ADD_RES (aPass_ID IN VARCHAR2, aSSN IN CHAR, aflight_num IN CHAR)
is
begin
 insert into Reservation(Pass_ID, rSSN, rflight_num)
 VALUES(aPass_ID, aSSN, aflight_num);
 
 update Flights set seats = seats - 1
 where Flight_num = aflight_num;
end ADD_RES;



procedure UP_RES (aPass_ID IN VARCHAR2, aflight_num in CHAR)
is
original_flight CHAR(9);
begin
  select rflight_num  
  into original_flight from Reservation
  where Pass_ID = aPass_ID;

  update Flights set seats = seats + 1
  where original_flight = Flight_num;

  update RESERVATION set rflight_num = aflight_num
  where Pass_ID = aPass_ID;

  update Flights set seats = seats - 1
  where Flight_num = aflight_num;
end UP_RES;


procedure DEL_RES (aPass_ID IN VARCHAR2)
is
original_flight CHAR(9);
begin
  select rflight_num  
  into original_flight from Reservation
  where Pass_ID = aPass_ID;
 
  delete from Reservation
  where Pass_ID = aPass_ID;
 
  update Flights set seats = seats + 1
  where original_flight = Flight_num;
end DEL_RES;


procedure ADD_FLIGHT (aFlight_num IN CHAR, aairline IN VARCHAR2, adept_date IN DATE, aret_date IN DATE,
adept_time IN CHAR, aret_time IN CHAR, aseats IN CHAR, adestination IN CHAR)
is
begin
 insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
 VALUES(aFlight_num, aairline, adept_date, aret_date, adept_time, aret_time, aseats, adestination);
end ADD_FLIGHT;


procedure UP_FLIGHT (aFlight_num IN CHAR, aairline IN VARCHAR2, adept_date IN DATE, aret_date IN DATE,
adept_time IN CHAR, aret_time IN CHAR, aseats IN CHAR, adestination IN CHAR)
is
begin
 update Flights set airline = aairline, dept_date = adept_date, ret_date = aret_date, dept_time =

adept_time,
 ret_time = aret_time, seats = aseats, destination = adestination
        where Flight_num = aFlight_num;
end UP_FLIGHT;


procedure DEL_FLIGHT (aFlight_num IN CHAR)
is
begin
 delete from Flights
 where Flight_num = aFlight_num;
end DEL_FLIGHT;

     
end AIRLINE_MOD;
/



create table Pass_Info(SSN       CHAR(9)       PRIMARY KEY,
                       first_name    VARCHAR2(40)  NOT NULL,
                       last_name    VARCHAR2(40)  NOT NULL,
                       street    VARCHAR2(50)  NOT NULL,
                       city      VARCHAR2(50)  NOT NULL,
                       state     CHAR(2)       NOT NULL,
                       zip       CHAR(5)       NOT NULL,
                       phone     VARCHAR(12)   NOT NULL);


create table Flights(Flight_num       CHAR(5)        PRIMARY KEY,
                     airline          VARCHAR2(3)    
                   CHECK (airline IN ('TWA', 'SWA', 'AA', 'NWA', 'JB')),
                 dept_date        DATE           NOT NULL,
                     ret_date         DATE           NOT NULL,
                     dept_time        CHAR(4)        NOT NULL,
                     ret_time         CHAR(4)        NOT NULL,
                     seats            CHAR(180)      NOT NULL,
                     destination      CHAR(3)        NOT NULL
                       CHECK (destination IN ('OAK', 'LAX', 'PIT', 'DEN', 'DFW')));


create table Reservation(Pass_ID     VARCHAR2(5)   PRIMARY KEY,
                         rSSN        CHAR(9)      NOT NULL,
                           CONSTRAINT SSNFK FOREIGN KEY (rSSN)
                         REFERENCES Pass_Info(SSN),
                         rflight_num  CHAR(5)      NOT NULL,
                           CONSTRAINT FLIGHTFK FOREIGN KEY (rflight_num)
                        REFERENCES Flights(Flight_num));    

/*Populating Passenger Info */
insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('111111111', 'Uriah', 'Robins', '1908 cambridge', 'crofton', 'MD', '21114', '4107210404');

insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('222222222', 'David', 'Curry', '532 Meadow Mist', 'Odenton', 'MD', '21134', '4103050350');

insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('333333333', 'Chris', 'Williams', '123 fake st', 'East Bungalok', 'MI', '12323',

'7898786676');

insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('444444444', 'Jerome', 'Bettis', '1 winners lane', 'Pittsburgh', 'PA', '11111',

'4456568900');

insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('555555555', 'Hillary', 'Swank', '1435 Mockingbird', 'Hilltop', 'MD', '45456',

'3018431211');

insert into Pass_Info(SSN, first_name, last_name, street, city, state, zip, phone)
      VALUES('666666666', 'Jebediah', 'Springfield', '1313 evergreen lane', 'Springfield', 'KY',

'45454', '4766758787');



/*Populating Flight Info */
insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('111', 'AA', to_date('2/26/2007','MM/DD/YYYY'), to_date('3/4/2007','MM/DD/YYYY'), '1035',

'1523', '30', 'LAX');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('222', 'TWA', to_date('01/26/2007','MM/DD/YYYY'), to_date('1/30/2007','MM/DD/YYYY'),

'0000', '0930', '45', 'PIT');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('333', 'SWA', to_date('03/26/2007','MM/DD/YYYY'), to_date('3/30/2007','MM/DD/YYYY'),

'1435', '2100', '107', 'DEN');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('444', 'JB', to_date('04/26/2007','MM/DD/YYYY'), to_date('4/29/2007','MM/DD/YYYY'),

'1555', '0100', '110', 'DFW');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('555', 'NWA', to_date('02/18/2007','MM/DD/YYYY'), to_date('2/21/2007','MM/DD/YYYY'),

'0900', '1235', '70', 'OAK');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('666', 'AA', to_date('07/15/2007','MM/DD/YYYY'), to_date('7/22/2007','MM/DD/YYYY'),

'1230', '1600', '34', 'DEN');

insert into Flights(Flight_num, airline, dept_date, ret_date, dept_time, ret_time, seats, destination)
      VALUES('777', 'TWA', to_date('07/19/2007','MM/DD/YYYY'), to_date('7/21/2007','MM/DD/YYYY'),

'0845', '1700', '39', 'OAK');



/*Populating Reservation Info */
insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas1', '111111111', '111');

insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas2', '222222222', '222');

insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas3', '333333333', '333');

insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas4', '444444444', '444');

insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas5', '555555555', '555');

insert into Reservation(Pass_ID, rSSN, rflight_num)
      VALUES('pas6', '666666666', '666');    





Start Free Trial
[+][-]02.28.2007 at 06:26PM PST, ID: 18630672

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.28.2007 at 07:18PM PST, ID: 18630877

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.28.2007 at 07:21PM PST, ID: 18630889

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.28.2007 at 07:33PM PST, ID: 18630933

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Sign Up Now!
Solution Provided By: sapnam
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.28.2007 at 07:41PM PST, ID: 18630958

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.28.2007 at 07:44PM PST, ID: 18630965

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42