aspose file tools
The moose likes JDBC and the fly likes SQL to determine if column is updated Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "SQL to determine if column is updated" Watch "SQL to determine if column is updated" New topic
Author

SQL to determine if column is updated

Charisse Lane
Greenhorn

Joined: Apr 07, 2009
Posts: 14
I have a trigger (see below) that works to compare my headline column without any problems. I need to modify this trigger however because I also need to check whether or not another column (content_body) has been updated. I do NOT need to compare the actual values of the before and after of the content_body but rather use the columns_updated() or if update (content_body) to determine if the field was updated - even if set to the same value.

What is the best way for me to add this to my existing trigger? I would rather not create a new trigger against the same table because I'm afraid this may cause a trigger conflict. If not, please let me know.

Also, I'm open to using a stored procedure that I can call from my Java code base if you think that's a better approach. This stored proc would need to perform the same function as the trigger.


CREATE OR REPLACE TRIGGER TRG_ART_DT
AFTER UPDATE ON csp_tbl_article
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
WHEN (N.headline != O.headline )
BEGIN
UPDATE CSP_TBL_LASTMOD SET last_mod_date = sysdate
where content_guid=:N.vgn_guid;
END TRG_ART_DT;
/

I tried to modify as follows but it's not working:

CREATE OR REPLACE TRIGGER TRG_ART_DT
AFTER UPDATE ON csp_tbl_article
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
WHEN ( (N.headline != O.headline) OR (update (content_body) ) )
BEGIN
UPDATE CSP_TBL_LASTMOD SET last_mod_date = sysdate
where content_guid=:N.vgn_guid;
END TRG_ART_DT;
/
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: SQL to determine if column is updated
 
Similar Threads
Using Oracle package variables in JDBC.
Please help...triggers issue
doubt in oracle
Please help..triggers issue
Trigger