Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

HW again. Help please

$
0
0
Hello again. I have a new problem. My professor has not explain triggers and only gave an example to do one for an auto increment primary key. so im lost as to try an make this work. Can anyone point me to the right direction? The sequence has been declared already. Though it could be wrong as I am just that lost after 3 straight days of trying to get this to work.
Thanks for any help
Code:

CREATE OR REPLACE TRIGGER airportBeforeIURow
BEFORE INSERT OR UPDATE ON jpowell12.airport
FOR EACH ROW

BEGIN
SELECT airport_squence.NEXTVAL, destination, name, city, state, landing_fee, tie_down_fee, restrictions
INTO :new.destination
FROM DUAL;

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('ARM','Aeromexpress','College Park','GA',100,55,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('ATA','Athens','Athens','GA',95,65.5,'Single engine only:after 10:00am before 4:00pm  after 7:00 pm');

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('ATL','Hartsfield Atlanta','Atlanta','GA',775,75,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('BDC','Baldwin County','Millegeville','GA',98,75,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('BNA','Metropolitan Nashville','Nashville','TN',350,65.95,'Single engine;12 seat max;between 10:00 am - 3:30 pm');

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('CAM','C A Moore Municipal','Lexington','MS',150,78.9,'multi engine;20 seater max;anytime');

insert INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('CMA','Charleston Municipal','Charleston','MS',200,50,'any type of plane;any time - must have 24 hours notice;tiedow');

insert INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('GMA','Greenville Municipal','Greenville','MS',175,56.85,'single engine only:between 11:30am - 2:30pm;48hr notice;check');

insert INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('GNV','Gulfport-Biloxi','Gulf Port','MS',200,50,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('GVM','G V Montgomery','Forest','MS',90,50,'Limited to 24 seaters;24 hr notice');

insert INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('MOB','Melbourne International','Melbourne','FL',125,75, NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('MQY','Coastal Planes','Mount Olive','NC',105,89.9,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('RLA','Reelfoot Lake','Tiptonville','TN',205,90.9,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('SCR','Summer County Regional','Gallatin','TN',345,135.9,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('SFA','Scott Field','Parsons','TN',125,75,'Single engine only;24 hr notice');

insert into AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('SRC','Smyrna/Rutherford County','Smyrna','TN',210,56.78,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('STL','Huntsville International','Huntsville','AL', 175,59.8,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('TYS','Mc Gee Tyson','Knoxville','TN',203,95.9,NULL);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('ABQ','Albuquerque International','Albuquerque','NM',230,75,'All aircraft; 12 hr notice');

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('PWM','PORTLAND INTL JETPORT', 'PORTLAND', 'ME',250.00, 150.00, null);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('TTN', 'Trenton Mercer AIRPORT','TRENTON', 'NJ', 150.00, 75.00, null);

INSERT INTO AIRPORT
(destination, name, city, state, landing_fee, tie_down_fee, restrictions)
VALUES('VJI','VIRGINIA HIGHLANDS', 'ABINGDON','VA', 275.00, 150.00, 'SINGLE ENGINE ONLY');

COMMIT;

END airportBeforeIURow;


Viewing all articles
Browse latest Browse all 13329

Trending Articles