Results 1 to 4 of 4

Thread: help in trigger

  1. #1
    Join Date
    Dec 2012
    Posts
    12

    Unanswered: help in trigger

    please anyone help me in this:

    I have this table
    -CREATE TABLE Student_test (
    test_num NUMBER NULL,
    correct_answer VARCHAR2(20) NULL,
    stud_answer VARCHAR2(20) NULL,
    grade NUMBER NULL,
    CONSTRAINT STUDENT_TEST_PK PRIMARY KEY (test_num)
    );

    I want a trigger work after insert and add in the grade10 if correct_answer = stud_answer
    else not equal add 0 in the grade


    for example:
    test_id|correct_answer|stud_answer|grade
    001 | Japan |Japan |1
    002 |China | UK |0

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    we don't do homework.
    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 2003
    Posts
    2,933
    Provided Answers: 12
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    If you want to update the existing row, it has to be a before trigger. Show us what you have tried and we will help with hints. No effort on your side, no effort on our side.
    Bill
    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
  •