Inserting old value into a column
From: R. Santiago <surfbot_at_rocketmail.com>
Date: 5 Oct 2003 13:46:01 -0700
Message-ID: <f28d4dcd.0310051246.610faf86_at_posting.google.com>
Date: 5 Oct 2003 13:46:01 -0700
Message-ID: <f28d4dcd.0310051246.610faf86_at_posting.google.com>
I have a table cc_rd_user_questions with the following columns:
NUM NUMBER (25) DEFAULT 1 NOT NULL, COMPANY_ID NUMBER (15) NOT NULL, PROJ_ID NUMBER (15) NOT NULL, SEQ NUMBER (25) NOT NULL, QUEST_ID NUMBER (15) NOT NULL, RESPONSE VARCHAR2 (40), CREATE_DATE DATE NOT NULL, LAST_UPDATE DATE NOT NULL
This table contains the responses to questions found on a form. The SEQ column is incremented each time a new row is inserted for a specific company and specific project). If during an insert the new RESPONSE column is null, what is the best method to populate the RESPONSE column with the previous RESPONSE column value (the previous row where COMPANY_ID, PROJ_ID and QUEST_ID are the same but SEQ = SEQ - 1)? Should I use a trigger (I forsee a "mutating" table problem), a temp table or SQL?
- Rey