ORA-25006 issue [message #355800] |
Mon, 27 October 2008 11:05 |
lientkhanh
Messages: 4 Registered: October 2008
|
Junior Member |
|
|
Hello everybody!
I'm trying to create a trigger to automatically update the import_date column of some records in my example_table whenever their clob_data are updated. To avoid mutual table problem. I used a global temporary table and a row-level trigger to keep track of the modified records. Then, a statement-level will do update on the import_date column. Following is my code:
-- Table to be updated
CREATE TABLE example_table
(id NUMBER NOT NULL PRIMARY KEY,
clob_data CLOB,
import_date TIMESTAMP);
-- Temporary table
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
id NUMBER)
ON COMMIT DELETE ROWS;
-- Trigger to keep track of modified records
CREATE OR REPLACE TRIGGER trig_get_modified_recs
AFTER UPDATE ON example_table
FOR EACH ROW
BEGIN
INSERT INTO my_temp_table
VALUES (:NEW.id);
END;
/
-- Trigger to update the import_date to SYSDATE
CREATE OR REPLACE TRIGGER trig_update_ts
AFTER UPDATE OF clob_data ON example_table
BEGIN
UPDATE example_date
SET import_date = SYSDATE
WHERE id IN (SELECT id FROM my_temp_table);
END;
/
The problem is that trig_update_ts trigger get compilation error 'ORA-25006: cannot specify this column in UPDATE OF clause'. To solve this problem, someone told me that I should remove the UPDATE OF clause. However, if I do that, the UPDATE statement in this trigger will cause recursive problem, because the two triggers will fire again right after the second modifies the import_date column. Using UPDATE OF, I can prevent this. The second trigger only fires if clob_data is changed. But for CLOB colum, it is impossible. Could anybody give a clean solution to this issue?
Thank you very much,
lientkhanh
|
|
|
|
Re: ORA-25006 issue [message #355808 is a reply to message #355805] |
Mon, 27 October 2008 12:41 |
lientkhanh
Messages: 4 Registered: October 2008
|
Junior Member |
|
|
Thanks Michel for your suggestion. But removing clause will get recursive issue because updating import_date forces the two triggers to execute again and again if we don't have a way to stop them.
How can I handle this indefinitive loop?
|
|
|
|
|
|
Re: ORA-25006 issue [message #355844 is a reply to message #355843] |
Mon, 27 October 2008 23:47 |
lientkhanh
Messages: 4 Registered: October 2008
|
Junior Member |
|
|
Yes, I see. Actually, I only need the date and time information but subsecond precision. Change import_date to DATE is the right way to do.
Best regards,
lientkhanh
|
|
|