Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Unanswered: Need help with Trigger compilation errors

    Hi, I need some help solving a trigger compilation error. I can't seem to find what is wrong with it, maybe one of you can.

    Here is the script i used to make it.

    CREATE OR REPLACE TRIGGER emp_time_check
    BEFORE UPDATE ON EMPLOYEE
    BEGIN
    IF (TO_CHAR(SYSDATE,'DY') NOT IN ('MON','WED')) OR
    (TO_CHAR(SYSDATE,'HH24:MI') NOT BETWEEN '08:00' AND '18:00')
    THEN RAISE_APPLICATION_ERROR (-20501, 'You can't update the EMPLOYEE table unless it is Monday or Wednesday.');
    END IF;
    END;
    /

    The error message is I receive after showing errors is as follows:

    Error at line 4/49 Encountered the symbol 'T' when expecting one of the following ) , * & | = - + < / > ....

    Any help would be appreciated. Thanks!

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    do NOT use an apostrophe inside of a quoted string!

    "can not" should replace "can't"
    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    That cleared that up for me. Thanks a bunch!

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by anacedent View Post
    do NOT use an apostrophe inside of a quoted string!
    Why not?
    You just need to escape it:
    Code:
    RAISE_APPLICATION_ERROR (-20501, 'You can''t update the EMPLOYEE table unless it is Monday or Wednesday.');

Posting Permissions

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