:NEW in trigger [message #351337] |
Tue, 30 September 2008 06:46 |
arjunyadav
Messages: 15 Registered: September 2008
|
Junior Member |
|
|
Hi Friends,
As I have written bellow the trigger ,when trigger gets fire
then I have to display the new value of the column while I am fetching the column name from cursor.But pseudo column :NEW is expecting the column name of the table directly(:NEW.column_name).when I use :new.circle_code(circle_code is table column) then it works but circle_code I have to get from cursor so I am writing :NEW.V_CUR.COLUMN_NAME but trigger is not supporting this syntax .Please guide how can I write the syntax of trigger to be successful.
CREATE OR REPLACE TRIGGER CRM_MASTER_UPDATION
BEFORE UPDATE ON CUSTMASTER
FOR EACH ROW
BEGIN
FOR V_CUR IN (SELECT UM.COLUMN_NAME
FROM USER_TAB_COLUMNS UM
WHERE UM.TABLE_NAME = 'CUSTMASTER') LOOP
DBMS_OUTPUT.PUT_LINE(:NEW.V_CUR.COLUMN_NAME);
END LOOP;
END;
|
|
|
Re: :NEW in trigger [message #351339 is a reply to message #351337] |
Tue, 30 September 2008 06:52 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Why would you ever want to do this?
what is the actual requirement that you are trying to fulfil like this?
Just write the trigger by hand, or write a piece of SQL to generate the code to go inside the trigger.
|
|
|
|