I think my query needs temp variables instead of using NEW but I am not sure how. Here is my query: delimiter // DROP TRIGGER trg_pic_hours; create trigger trg_pic_hours after insert on CREW for each...


I think my query needs temp variables instead of using NEW but I am not sure how.



Here is my query:


delimiter //


DROP TRIGGER trg_pic_hours;


create trigger trg_pic_hours


after insert on CREW


for each row


begin


IF NEW.CREW_JOB = 'Pilot' THEN


update PILOT


set PIL_PIC_HRS = PIL_PIC_HRS +


( select CHAR_HOURS_FLOWN from CHARTER where CHAR_TRP = NEW.CHAR_TRP)


where EMP_NUM = NEW.EMP_NUM;


END IF;



END //



If I run the query with the NEW.CHAR_TRP entry errors out if I remove NEW from it it will run ok.


I have attached the schema


FIGURE P8.35 CH08_AVIACO DATABASE TABLES<br>Table name: CHARTER<br>Database name: Ch08_AviaCo<br>CHAR_TRIP CHAR_DATE AC_NUMBER CHAR_DESTINATION CHAR_DISTANCE CHAR_HOLRS_FLOVIN CHAR_HDURS_WAIT CHAR_FUEL_GALLONS CHAR_OIL_QTS CUS_CODE<br>10001<br>05-Feb-18 2289L<br>Table name: EARNEDRATING<br>ATL<br>936<br>5.1<br>2.2<br>354.1<br>10011<br>10002<br>05-Feb-18 2778V<br>BNA<br>320<br>1.6<br>72.6<br>10016<br>EMP_NUM RTG_CODE EARNRTG DATE<br>10003<br>10004<br>05-Feb-18 4278Y<br>GNV<br>1574<br>7.8<br>339.8<br>2<br>10014<br>06-Feb-18 1484P<br>STL<br>472<br>2.9<br>4.9<br>97.2<br>1<br>10019<br>101 CFI<br>18-Feb-98<br>10005<br>06-Feb-18 2289L<br>ATL<br>1023<br>5.7<br>3.5<br>397.7<br>2<br>10011<br>101 CFII<br>15-Dec-05<br>10006<br>06-Feb-18 4278Y<br>472<br>26<br>5.2<br>117.1<br>10017<br>10012<br>STL<br>101 NSTR<br>08-Nov-93<br>10007<br>348.4<br>23-Jun.94<br>06-Feb-18 2778V<br>CNV<br>1574<br>1.9<br>2<br>101 MEL<br>10008<br>07-Feb-18 1484P<br>TYS<br>644<br>10014<br>4.1<br>140.8<br>101 SEL<br>21-Apr.93<br>15 Jul 96<br>10017<br>10016<br>10012<br>10010<br>10009<br>07-Fob-10 2209L.<br>ONV<br>1574<br>6.6<br>23.4<br>459.9<br>104 NSTR<br>10010<br>07-Feb-10 4270Y<br>6.2<br>AIL<br>930<br>3.2<br>279.7<br>104 MEL<br>29-Jan-97<br>12-Mar 95<br>18-Nov-97<br>10011<br>07-Feb-18 1484P<br>BNA<br>352<br>1.9<br>5.3<br>66.4<br>1<br>104 SEL<br>10012<br>08-Feb-18 2776V<br>MOB<br>84<br>4.8<br>4.2<br>215.1<br>105 CFI<br>10013<br>08-Feb-18 4278Y<br>TYS<br>644<br>3.9<br>4.5<br>174.3<br>1<br>10011<br>105 NSTR<br>17-Apr-95<br>12-Aug-95<br>10014<br>09-Feb-18 4278Y<br>ATL<br>936<br>6.1<br>2.1<br>302.6<br>10017<br>105 MEL<br>10015 09-Feb-18 2289L<br>GNV<br>1645<br>67<br>459.5<br>2<br>10016<br>105 SEL<br>23-Sep-94<br>10011<br>10014<br>10016 09-Feb-18 2778V<br>MQY<br>312<br>1.5<br>67.2<br>106 NSTR<br>20-Dec-95<br>10017 10-Feb-18 1484P<br>STL<br>508<br>3.1<br>105.5<br>106 MEL<br>02-Apr-96<br>10018<br>10-Feb-18 4278Y<br>TYS<br>644<br>3.8<br>4.5<br>167.4<br>10017<br>106 SEL<br>10-Mar-94<br>109 CFI<br>05-Nov-98<br>109 CFI<br>109 NSTR<br>21-Jun-03<br>Table name: CREW<br>Table name: CUSTOMER<br>23-Jul-96<br>109 MEL<br>15-Mar-97<br>CUS CCDE CUS_LNAME CLS_FNAME CUS_INITIAL CUS AREACODE CUS PHDNE CUS BALANCE<br>000<br>000<br>896 54<br>CHAR TRP<br>EMP_NUM CREW JOB<br>109 SEL<br>05-Feb-96<br>104 Filot<br>101 Filot<br>10001<br>10010 Ramas<br>Alfred<br>615<br>844-2573<br>109 SES<br>12-May-96<br>10002<br>10011 Dunne<br>Leona<br>713<br>894-1238<br>894-2285<br>894-2180<br>222-1672<br>442-3381<br>10003<br>105 Filot<br>10012 Snith<br>Kathy<br>615<br>10003<br>109 Coplot<br>10013 Obwski<br>Paul<br>F<br>615<br>1285.19<br>Table name: RATING<br>673 21<br>1014 56<br>10004<br>108 Filot<br>10014 Orlando<br>Myron<br>615<br>10005<br>RTG CODE<br>101 Filot<br>10015 OBrian<br>Amy<br>James<br>George<br>713<br>RTG NAME<br>10006<br>297-1228<br>290-2556<br>382-7185<br>109 Filot<br>10016 Brown<br>615<br>000<br>CFI<br>Certified Flight Instructor<br>Certified Flight Instructor, Instrument<br>10017 illiams<br>10018 Farriss<br>10007<br>104 Filot<br>615<br>00<br>CFI<br>INSTR<br>MEL<br>10007<br>105 Coplot<br>Anne<br>713<br>000<br>Instrument<br>10008<br>106 Filot<br>10019 Snith<br>Dlette<br>615<br>297-3809<br>453 98<br>Multiengine Land<br>Single Engine, Land<br>10009<br>105 Filot<br>SEL<br>10010<br>100 Filot<br>SES<br>Single Engine, Sea<br>101 Filot<br>104 Coplot<br>Table name: EMPLOYEE<br>10011<br>10011<br>EMP_NUM EMP_TITLE EMP_LNAME<br>101 Filot<br>105 Filot<br>EMP DOB<br>15-Jun-1942<br>19-Mar-1965<br>EMP FNAME EMP_INTIAL<br>EMP HIRE DATE<br>Table name: MODEL<br>10012<br>10013<br>100 Mr.<br>Kolmycz<br>George<br>15-Mar-1987<br>Lewe<br>Vandam<br>Jones<br>10014<br>105 Filot<br>101 Ms.<br>Rhonda<br>G<br>25-Apr-1988<br>MOD_CODE MOD_MANUFACTURER MOD NAME<br>MOD_SEATS MOD_CHG_MILE<br>10015<br>10015<br>10016<br>101 Coplot<br>102 Mr.<br>Rhett<br>14-Nov-1958<br>20-Dec-1992<br>C-90A<br>Beechcraft<br>KingAir<br>267<br>104 Pilot<br>103 Ms.<br>Anne<br>16-Oct-1974<br>28-Aug-2005<br>PA23-250<br>Piper<br>Azter<br>193<br>105 Coplot<br>Lange<br>Wlliems<br>104 Mr<br>John<br>P<br>08-Nov-1971<br>20-Oct-1996<br>PA31-350<br>Piper<br>Navajo Chieftain<br>10<br>235<br>10016<br>10017<br>08-Jan-2006<br>05-Jan-1991<br>109 Filot<br>101 Filot<br>104 Coplot<br>105 Filot<br>105 Mr<br>Robert<br>D<br>14-Mar-1975<br>Duzak<br>Diante<br>106 Mrs.<br>Jeanne<br>K<br>12-Feb-1968<br>10018<br>10018<br>21-Aug-1974<br>14-Feb-1966<br>107 Mr<br>02-Jul-1996<br>Jorge<br>Wiesenbach Paul<br>108 Mr<br>18-Nov-1994<br>109 Ms.<br>110 Mrs<br>Travis<br>Elzabeth<br>K<br>18-Jun-1961<br>14-Apr-1991<br>Genkazi<br>Leighla<br>19-May-1970<br>01-Dec-1992<br>Table name: AIRCRAFT<br>Table name: PILOT<br>|AC NUMBER MOD CODE | AC TTAF<br>AC TTEL<br>AC_TTER<br>EMP_NUM PIL LICENSE|<br>FIL RATINGS<br>PL MED TYPE PIL MED DATE PIL PT135 DATE<br>PA23-250<br>C-90A<br>РАЗ1-350<br>1833.1<br>4243.8<br>1484P<br>1833.1<br>101.8<br>101 ATP<br>ATP/SELMELAnstr/CFII<br>1<br>20-Jan-18<br>11-Jan-18<br>2239L<br>18-Dec-17<br>05-Jan-18<br>768.9<br>1123.4<br>104 ATP<br>105 COM<br>ATP/SELMELAnstr<br>1<br>17-Jan-18<br>2778Y<br>7992.9<br>2147.3<br>1513.1<br>789.5<br>COMM/SELMELAnstr/CFI<br>02-Jan-18<br>4278Y<br>PA31-350<br>622.1<br>243.2<br>106 COM<br>COMMISELMELInstr<br>2<br>10-Dec-17<br>02-Feb-18<br>109 COM<br>ATP/SELMEL/SESAnstr/CFI 1<br>22-Jan-18<br>15-Jan-18<br>

Extracted text: FIGURE P8.35 CH08_AVIACO DATABASE TABLES Table name: CHARTER Database name: Ch08_AviaCo CHAR_TRIP CHAR_DATE AC_NUMBER CHAR_DESTINATION CHAR_DISTANCE CHAR_HOLRS_FLOVIN CHAR_HDURS_WAIT CHAR_FUEL_GALLONS CHAR_OIL_QTS CUS_CODE 10001 05-Feb-18 2289L Table name: EARNEDRATING ATL 936 5.1 2.2 354.1 10011 10002 05-Feb-18 2778V BNA 320 1.6 72.6 10016 EMP_NUM RTG_CODE EARNRTG DATE 10003 10004 05-Feb-18 4278Y GNV 1574 7.8 339.8 2 10014 06-Feb-18 1484P STL 472 2.9 4.9 97.2 1 10019 101 CFI 18-Feb-98 10005 06-Feb-18 2289L ATL 1023 5.7 3.5 397.7 2 10011 101 CFII 15-Dec-05 10006 06-Feb-18 4278Y 472 26 5.2 117.1 10017 10012 STL 101 NSTR 08-Nov-93 10007 348.4 23-Jun.94 06-Feb-18 2778V CNV 1574 1.9 2 101 MEL 10008 07-Feb-18 1484P TYS 644 10014 4.1 140.8 101 SEL 21-Apr.93 15 Jul 96 10017 10016 10012 10010 10009 07-Fob-10 2209L. ONV 1574 6.6 23.4 459.9 104 NSTR 10010 07-Feb-10 4270Y 6.2 AIL 930 3.2 279.7 104 MEL 29-Jan-97 12-Mar 95 18-Nov-97 10011 07-Feb-18 1484P BNA 352 1.9 5.3 66.4 1 104 SEL 10012 08-Feb-18 2776V MOB 84 4.8 4.2 215.1 105 CFI 10013 08-Feb-18 4278Y TYS 644 3.9 4.5 174.3 1 10011 105 NSTR 17-Apr-95 12-Aug-95 10014 09-Feb-18 4278Y ATL 936 6.1 2.1 302.6 10017 105 MEL 10015 09-Feb-18 2289L GNV 1645 67 459.5 2 10016 105 SEL 23-Sep-94 10011 10014 10016 09-Feb-18 2778V MQY 312 1.5 67.2 106 NSTR 20-Dec-95 10017 10-Feb-18 1484P STL 508 3.1 105.5 106 MEL 02-Apr-96 10018 10-Feb-18 4278Y TYS 644 3.8 4.5 167.4 10017 106 SEL 10-Mar-94 109 CFI 05-Nov-98 109 CFI 109 NSTR 21-Jun-03 Table name: CREW Table name: CUSTOMER 23-Jul-96 109 MEL 15-Mar-97 CUS CCDE CUS_LNAME CLS_FNAME CUS_INITIAL CUS AREACODE CUS PHDNE CUS BALANCE 000 000 896 54 CHAR TRP EMP_NUM CREW JOB 109 SEL 05-Feb-96 104 Filot 101 Filot 10001 10010 Ramas Alfred 615 844-2573 109 SES 12-May-96 10002 10011 Dunne Leona 713 894-1238 894-2285 894-2180 222-1672 442-3381 10003 105 Filot 10012 Snith Kathy 615 10003 109 Coplot 10013 Obwski Paul F 615 1285.19 Table name: RATING 673 21 1014 56 10004 108 Filot 10014 Orlando Myron 615 10005 RTG CODE 101 Filot 10015 OBrian Amy James George 713 RTG NAME 10006 297-1228 290-2556 382-7185 109 Filot 10016 Brown 615 000 CFI Certified Flight Instructor Certified Flight Instructor, Instrument 10017 illiams 10018 Farriss 10007 104 Filot 615 00 CFI INSTR MEL 10007 105 Coplot Anne 713 000 Instrument 10008 106 Filot 10019 Snith Dlette 615 297-3809 453 98 Multiengine Land Single Engine, Land 10009 105 Filot SEL 10010 100 Filot SES Single Engine, Sea 101 Filot 104 Coplot Table name: EMPLOYEE 10011 10011 EMP_NUM EMP_TITLE EMP_LNAME 101 Filot 105 Filot EMP DOB 15-Jun-1942 19-Mar-1965 EMP FNAME EMP_INTIAL EMP HIRE DATE Table name: MODEL 10012 10013 100 Mr. Kolmycz George 15-Mar-1987 Lewe Vandam Jones 10014 105 Filot 101 Ms. Rhonda G 25-Apr-1988 MOD_CODE MOD_MANUFACTURER MOD NAME MOD_SEATS MOD_CHG_MILE 10015 10015 10016 101 Coplot 102 Mr. Rhett 14-Nov-1958 20-Dec-1992 C-90A Beechcraft KingAir 267 104 Pilot 103 Ms. Anne 16-Oct-1974 28-Aug-2005 PA23-250 Piper Azter 193 105 Coplot Lange Wlliems 104 Mr John P 08-Nov-1971 20-Oct-1996 PA31-350 Piper Navajo Chieftain 10 235 10016 10017 08-Jan-2006 05-Jan-1991 109 Filot 101 Filot 104 Coplot 105 Filot 105 Mr Robert D 14-Mar-1975 Duzak Diante 106 Mrs. Jeanne K 12-Feb-1968 10018 10018 21-Aug-1974 14-Feb-1966 107 Mr 02-Jul-1996 Jorge Wiesenbach Paul 108 Mr 18-Nov-1994 109 Ms. 110 Mrs Travis Elzabeth K 18-Jun-1961 14-Apr-1991 Genkazi Leighla 19-May-1970 01-Dec-1992 Table name: AIRCRAFT Table name: PILOT |AC NUMBER MOD CODE | AC TTAF AC TTEL AC_TTER EMP_NUM PIL LICENSE| FIL RATINGS PL MED TYPE PIL MED DATE PIL PT135 DATE PA23-250 C-90A РАЗ1-350 1833.1 4243.8 1484P 1833.1 101.8 101 ATP ATP/SELMELAnstr/CFII 1 20-Jan-18 11-Jan-18 2239L 18-Dec-17 05-Jan-18 768.9 1123.4 104 ATP 105 COM ATP/SELMELAnstr 1 17-Jan-18 2778Y 7992.9 2147.3 1513.1 789.5 COMM/SELMELAnstr/CFI 02-Jan-18 4278Y PA31-350 622.1 243.2 106 COM COMMISELMELInstr 2 10-Dec-17 02-Feb-18 109 COM ATP/SELMEL/SESAnstr/CFI 1 22-Jan-18 15-Jan-18
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here