Q

Why isn't my trigger working correctly?

A SearchOracle.com member asks why new values are not getting in the backup table after creating a trigger.

I have created a trigger, but new values are not getting in the backup table. I am given this statement. Please help me.

create or replace trigger "SUPPQUOTES_AUDIT"
after update or delete on phsuppquotes for each row begin insert into
phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values
(:new.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);

Your code above does not have the following lines:

END;
/

That may just be an oversight, however.

When you update or delete a record on the phsuppquotes table, what error, if any are you getting? There could be many reasons why your trigger is not working correctly, so error message help. Also, ensure the trigger is firing by changing your INSERT statement to insert just some dummy literal values instead of variable values and then test.

This was first published in January 2008

Dig deeper on Oracle database administration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close