Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2009

    Unanswered: Trigger created with compilation errors

    Please please,somebody help me out with this error.
    I have created a trigger but it says with compilation errors.
    Here is the erroe code.

    SQL> create trigger travel before insert or update on reservation
    2 begin
    3 if(source='Mumbai' and destination='New York')
    4 then raise_application_error(666,'No direct flight from Mumbai to New York'
    5 end if;
    6 end;
    7 /

    Warning: Trigger created with compilation errors.

    SQL> show errors trigger travel;
    Errors for TRIGGER TRAVEL:

    -------- -----------------------------------------------------------------
    4/1 PLS-00103: Encountered the symbol "END" when expecting one of the
    := . ( % ;
    The symbol ";" was substituted for "END" to continue.

    Thanks a lot in advance.

  2. #2
    Join Date
    Jun 2003
    West Palm Beach, FL

    Thumbs down Duh!

    You need a semi-colon ( ; ) at the end of statement #4.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Apr 2009
    Thanx a lot

  4. #4
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    But that's not all ...
    • "source" and "destination" miss the ":new." identifier
    • once you add them, trigger will fail because :new / :old aren't allowed in a table level triggers, so - add FOR EACH ROW
    • now trigger will compile, but an invalid combination of the source and destination column (Mumbai & NY) will end up with another error, because error number argument of the RAISE_APPLICATION_ERROR is out of range - you, as a developer, are restricted to use values between -20000 and -20999

    Once you fix all of the above, trigger will do what it is supposed to.

  5. #5
    Join Date
    Sep 2011

    Trigger warning

    hi, I also got the same warning when i created the simple trigger,
    HereZ what i have wrote

    SQL> create or replace
    2 trigger person_trig
    3 before insert on person
    4 for each row
    5 begin
    6 DBMS_oUTPUT.PUT_LINE ('before insert of ;||;
    7 END;
    8 /

    Warning: Trigger created with compilation errors.

    it says the above error message, i do not understand why it is coming so,
    please advice some one


  6. #6
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    >6 DBMS_oUTPUT.PUT_LINE ('before insert of ;||;
    for one it appears a closing sing quote mark is missing (error of omission)
    DBMS_OUTPUT.PUT_LINE ('before insert of ;' ||;
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    Sep 2011
    Wel wel.. i really did missed tht :P
    thankZ any wayZ , wel im kinda new and im learning tru google...
    any wayZ, we get compilation errors when ever the syntax is wrong. is it ?

  8. #8
    Join Date
    Jun 2004
    Liverpool, NY USA
    Anjala Please do not hijack a thread, start a new one. Yes, if code has an error it will give the compilation error message. Simply type

    show errors

    to see what is wrong.
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts