Home » SQL & PL/SQL » SQL & PL/SQL » :NEW in trigger
:NEW in trigger [message #351337] Tue, 30 September 2008 06:46 Go to next message
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 Go to previous messageGo to next message
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.
Re: :NEW in trigger [message #351350 is a reply to message #351337] Tue, 30 September 2008 07:58 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
You do know that dbms_output has no function in a trigger, right?
Previous Topic: How to get last compiled version of package.?
Next Topic: Date conversion error
Goto Forum:
  


Current Time: Sun Dec 04 10:50:45 CST 2016

Total time taken to generate the page: 0.08946 seconds