Q
Problem solve Get help with specific problems with your technologies, process and projects.

Using a trigger with a variable value

I have prepared a trigger where the column name is in a variable:

m_FldName := 'ALTID';

Now I need to use something like "DBMS_OUTPUT.PUT_LINE(:NEW.m_FldName)", much like a macro substitution. How can I achieve this?


To use the variable value, just use the variable name. In your example, the code would look like the following:

DBMS_OUTPUT.PUT_LINE(m_FldName)

The ":NEW." is not necessary in this case.

But using DBMS_OUTPUT in a trigger does not make sense. In order for DBMS_OUTPUT to make sense, there must be something that will capture that output. Calls to DBMS_OUTPUT from a trigger will write the data to a dead end, and you'll never see the output. I'm not sure what you are trying to do here, so I really can't give you any advice on how to change this specific line of code.


Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close