Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: compilation errors

    I get this error

    Warning: Trigger created with compilation errors.

    when i write the following triggers:


    CREATE OR REPLACE TRIGGER check_grade_point
    BEFORE INSERT ON Grade_Point
    FOR EACH ROW
    DECLARE
    error_msg CHAR(180);
    num integer;
    BEGIN
    select count(*) into num from grade_point;
    if (num > 0) then raise error;
    END;
    /

    CREATE OR REPLACE TRIGGER In_GradeReport
    BEFORE INSERT ON grade_report
    FOR EACH ROW
    DECLARE
    BEGIN
    :new.StudentName := find_sname(:new.StudentNumber);
    :new.GradePoint := find_gpoint(:new.grade);
    END;
    /

    get the same error in both of them

    Does anyone knows what I am doing wrong?

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >get the same error in both of them
    ERROR? What Error? I don't see any error.

    It is really, Really, REALLY difficult to fix a problem that can not be seen.
    use COPY & PASTE so we can see what you do & how Oracle responds.
    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
    Nov 2010
    Posts
    2

    why the warning message?

    SQL> CREATE TABLE grade_Point
    (A NUMBER(1) NOT NULL,
    B NUMBER(1) NOT NULL,
    C NUMBER(1) NOT NULL,
    D NUMBER(1) NOT NULL,
    CONSTRAINT ch_grade
    CHECK ((10 > A) AND (A > B) AND (B > C) AND (C > D) AND (D > 0))); 2 3 4 5 6 7

    Table created.

    SQL> CREATE OR REPLACE TRIGGER check_grade_point
    BEFORE INSERT ON Grade_Point
    FOR EACH ROW
    DECLARE
    error_msg CHAR(180);
    num integer;
    BEGIN
    select count(*) into num from grade_point;
    if (num > 0) then raise error;
    END;
    / 2 3 4 5 6 7 8 9 10 11

    Warning: Trigger created with compilation errors.

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Sql> show error
    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.

  5. #5
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Every "IF" should have "END IF" - yours doesn't.

    What is "raise error" supposed to do? What is "error"? Oracle doesn't quite understand spoken English, so you have to stick to coding rules.

  6. #6
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by Littlefoot View Post
    What is "raise error" supposed to do? What is "error"? Oracle doesn't quite understand spoken English, so you have to stick to coding rules.
    Although there is a RAISE Statement there is no pre-defined exception called ERROR as far as I can tell

  7. #7
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Quote Originally Posted by Shammat
    there is no pre-defined exception called ERROR
    That's what I had on my mind.

Posting Permissions

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