Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trigger Validation Failed

MikailJun 16 2011 — edited Jun 16 2011
Hi,
I want to keep track of changes to one table in another table. What I need is an after update trigger which writes the name of changed column (if multiple columns are changed then there will be multiple inserts to the CHANGES table),the column's old and new values. How do I do that. I tried this but got an error after insert.So I'm giving you just the body.

IF :NEW.STAJYEAR!=:OLD.STAJYEAR THEN
INSERT INTO X_STAJ (USERID,EDITDATE,CHANGEDCOLUMN,OLDVALUE,NEWVALUE)
VALUES (:NEW.USERID,SYSDATE,'STAJYEAR',:OLD.STAJYEAR,:NEW.STAJYEAR);
END IF;

Comments

Hamza Al-abbasi

Hello venapex,
I have miss understand what are you want to achieve, can you reproduce it on apex.oracle.com?

Answer

HI,
in general, it's recommended to have your Interactive Grid Query returning column names in upper case and without spaces. Each column has the Heading and Label attributes where you can specify the content to display to end users.
The reason for this not working is that Interactive Grid column values are provided by APEX session state, which is the same thing as page items. And page item names in APEX are ... case-insensitive and must not contain spaces. So it's the same restrictions which apply here.
But the solution is easy: Just change your query to return "clean" column names, and use the Label and Heading attributes to provide content to be displayed in the UI.
Bildschirmfoto 2021-10-21 um 11.11.51.pngBest regards
-Carsten

Marked as Answer by venapex · Nov 9 2021
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 14 2011
Added on Jun 16 2011
1 comment
93 views