|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Trigger Compilation Error
Having some trouble trying to figure out this compilation error, can anyone help?
CREATE OR REPLACE TRIGGER match_gender_check BEFORE INSERT OR UPDATE ON matches FOR EACH ROW BEGIN DECLARE homegender VARCHAR(1); oppgender VARCHAR(1); BEGIN SELECT h.teamgender INTO homegender FROM hometeams h WHERE :new.hometeam = REF(h); SELECT o.teamgender INTO oppgender FROM opponentteams o WHERE :new.opponent = REF(o); END IF(homegender != oppgender) THEN RAISE_APPLICATION_ERROR(-20012, 'Teams Of Opposite Gender Cannot Play Against Each Other'); END; / Thanks! |
|
#2
|
|||
|
|||
|
Never mind i got it. Here's the corrected version in case some lost fool is searching for it in future:
CREATE OR REPLACE TRIGGER match_gender_check BEFORE INSERT OR UPDATE ON matches FOR EACH ROW DECLARE homegender VARCHAR(1); oppgender VARCHAR(1); BEGIN SELECT h.teamgender INTO homegender FROM hometeams h WHERE :new.hometeam = REF(h); SELECT o.teamgender INTO oppgender FROM opponentteams o WHERE :new.opponent = REF(o); IF(homegender != oppgender) THEN RAISE_APPLICATION_ERROR(-20012, 'Boys Are Better Than Girls. Its Just Not Fair.'); END IF; END; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Trigger Compilation Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|