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 6671695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:25:09+00:00 2026-05-26T03:25:09+00:00

I want the trigger to run after each and every record that gets inserted.

  • 0

I want the trigger to run after each and every record that gets inserted.

This validation works fine if I have a simple insert like this:

insert into g_dossier values
               (112334, 'BBT', 'LPO','TTS','Y') ;

However, when it’s like a bulk insert like this:

INSERT INTO g_piece(
                refpiece,
                typpiece,
                class_piece
                group_piece
                flag_piere)    
SELECT         :new.element_num,
                PROC_TYPE,
                DECODE( piece_it, 'F', 'FTTR', 'N', 'FTTR', NULL ),
                DECODE( piece_it, 'T', 'TTSN', 'N', 'TTSN', NULL ),
                'N'
FROM    t_elements
WHERE   :new.db_piece_flag = 'Y';

The trigger mutates. I want that the validation also work when done as a bulk insert.

The query causing this problem is

SELECT COUNT(*)
INTO existing_cmcl_cnt
FROM g_piece cmcl
WHERE cmcl.class_piece= :new.class_piece

The problem is that this query is called in a trigger applied on the same table “g_piece”. When I proceed with a simple insert (insert into g_piece values(…)), I do not have this problem.

How can I avoid this problem?
Thanks.

  • 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-05-26T03:25:10+00:00Added an answer on May 26, 2026 at 3:25 am

    Here you should change the query and insert the result of a SELECT ... FROM some join, not using a trigger at all. You want that when inserting into table X, a trigger also inserts into the same table, which is not possible (it would recurse).

    If you cannot change the query, you should rename your table, create a view to the table with the old name, and create a TRIGGER INSTEAD OF INSERT ON that view FOR EACH ROW
    that would INSERT INTO into the real table the result of a SELECT ... FROM some join.

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

Sidebar

Related Questions

I have a Quartz Job that I want to fire every minute. The job
I want to trigger an event that causes the ScrollPane to start scrolling up
I want to trigger a hyperlink by hitting Enter using jQuery. I have the
I want to trigger on click of a button this: <asp:Button runat=server ID=submit Text=Submit
If I want to trigger an error in my interpreter I call this function:
I have a div, containing text and a few links. I want to trigger
I have written an update trigger, that does an update that could potentially call
I want to change the NLS_SORT and NLS_COMP parameters for every query to this
I have to dash away from the computer frequently, and I want to trigger
I want to call a function right after a scroll ends. I have tried

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.