Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:23:56+00:00 2026-06-05T19:23:56+00:00

My issue is that the trigger detailed below seems to execute correctly except for

  • 0

My issue is that the trigger detailed below seems to execute correctly except for the fact that the update statement UPDATE my_dblist
SET passive_servername = v_newpassive WHERE server = :NEW.server AND dbname = :NEW.dbname;
does not seem to happen. The old record is deleted and inserted into history correctly but the new record does not have the old active server listed under passive_servername. I have a feeling this might have something to do with it being autonomous?

create or replace
TRIGGER cluster_check
AFTER INSERT ON my_dblist
FOR EACH ROW
DECLARE
pragma autonomous_transaction;
v_duplicates NUMBER;
v_newpassive varchar2(30);
BEGIN
SELECT count(*) INTO v_duplicates FROM my_dblist WHERE passive_servername         = :new.server and dbname = :new.dbname order by 1;
IF v_duplicates > 0
THEN 
SELECT server INTO v_newpassive FROM my_dblist WHERE passive_servername = :NEW.server AND dbname = :NEW.dbname ORDER BY 1;
UPDATE my_dblist
SET passive_servername = v_newpassive WHERE server = :NEW.server AND dbname = :NEW.dbname;
INSERT INTO my_dblist_history 
SELECT * FROM my_dblist WHERE passive_Servername = :NEW.server AND dbname = :NEW.dbname;
DELETE FROM my_dblist 
WHERE passive_Servername = :NEW.server AND dbname = :NEW.dbname;
END IF;
commit;
END;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:23:57+00:00Added an answer on June 5, 2026 at 7:23 pm

    Your trigger is declared to use an autonomous transaction. That is almost always an error unless the sole purpose of the trigger is to log an attempt to change a row of data that you want to persist whether or not the change is ultimately successfully committed. In this case, it is also likely to be the source of your problem. Since the trigger is an autonomous transaction, it cannot see the uncommitted changes made by the triggering statement. Your UPDATE statement, for example, will not see the row(s) that caused the trigger to be fired because those rows are, by definition, uncommitted work done in a different transaction.

    Can you take a step back and explain exactly what problem you are trying to solve? I’m assuming that you are attempting to use an autonomous transaction to work around a mutating table exception. That is almost always a mistake. A mutating table exception almost universally indicates that you have a data model problem so you are much better served fixing the data model than working around the error. If you cannot correct the data model, you’ll need to use multiple triggers to work around the mutating table error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue with a trigger that inserts a value into the same
I have an issue that seems like very flaky behavour, is this a problem
Trigger is a recently re-detected SwingX issue : support deep - that is under
I'm having an issue that I suspect is being caused by the PHP feature
I am having an issue that I have spend way too much time trying
I'm having an issue that's killing me. Here's my code: $('.somediv.btn-2').live('click', function() { if
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I am having an issue that I can't seem to figure out. Hopefully somebody
I have an issue that looks like a race condition with a webview callback
There is an issue that I cannot solve, I've been looking a lot in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.