Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2015
    Posts
    1

    Unanswered: Creating trigger but having a "Warning: Trigger created with compilation errors."

    Hi there,

    I've been working on several triggers and always have this msg :
    Code:
    "Warning: Trigger created with compilation errors."
    I dunno why, here's one of the triggers that gives that msg :

    Code:
    CREATE OR REPLACE TRIGGER CityExists
        BEFORE INSERT OR UPDATE ON Player
        FOR EACH ROW 
        BEGIN
            WHEN (NOT EXISTS( SELECT idTeam FROM Team WHERE Team.idTeam = NEW.idTeam)) THEN 
                signal sqlstate '45000' 
                    set message_text = 'Attempt to insert a player with an non-existing city.';
            END
        END
    I don't know if i'm missing something here, a semicolon, a space or tab ?

  2. #2
    Join Date
    Dec 2008
    Location
    At work...
    Posts
    92
    This is not reallt an ANSI SQL related question.

    But I think there's a missing CASE, i.e.:
    CASE WHEN (NOT EXISTS( SELECT idTeam FROM Team WHERE...

Posting Permissions

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