Results 1 to 3 of 3

Thread: trigger

  1. #1
    Join Date
    Nov 2008
    Posts
    26

    Unanswered: trigger

    hi

    i m using a trigger for updating data from one denormalized table to all
    normalized tables


    in denormalized table i have colums from answer1 to answer35.

    i need to check null for every column and insert it into table.
    cant i use a for loop for this ????? and also i need to insert only those records which are not null.


    for i in 1..35 loop
    l_sql := 'insert into M__FORM_ANSWR_MAP(PROPOSALNO, FORMID,LIFEASSUREDID,ANSWER )
    values (:new.CONTRACTNO,:new.QUESTIONCODE,:new.LA_1_CLNT_ NO,:new.answer' || i)

    execute immediate l_sql;

    end loop;

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

    Cool :new?

    That dynamic sql statement will NOT WORK, the ":new" bind variable will be treated as parameter to the execute immediate and not as the trigger's variable.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

Posting Permissions

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