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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:59:09+00:00 2026-05-15T20:59:09+00:00

I’m trying to create a trigger that will do the following. After insert on

  • 0

I’m trying to create a trigger that will do the following.

After insert on Table A, query Table B based on an id (TableA.id=TableB.id) and insert corresponding info into TableA

I have a feeling I’m way off so far so any help would be appreciated

CREATE OR REPLACE TRIGGER myTrig
AFTER INSERT
ON TABLEA
BEGIN
  INSERT INTO TABLEA
  SELECT TABLEB.FIRST_NAME, TABLEB.LAST_NAME, SYSDATE
  FROM TABLEA JOIN TABLEB ON 
  TABLEA.STUDENT_ID=TABLEB.STUDENT_ID
  insert into TABLEA values (....);
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-05-15T20:59:10+00:00Added an answer on May 15, 2026 at 8:59 pm

    This will not work. Just think about what you are asking. You want a trigger that fires when a row is inserted into tableA to insert a row into tableA. When would the trigger stop firing?

    Oracle is smart enough to step in and prevent the trigger spiralling into infinity:

    SQL> create or replace trigger t69_after_ins
      2      after insert on t69
      3  begin
      4      insert into t69 values ('blah', 'blah', 99);
      5  end;
      6  /
    
    Trigger created.
    
    SQL>
    

    Here’s what happens:

    SQL> insert into t69 values ('this', 'that', 1)      
       2  /
    
    insert into t69 values ('this', 'that', 1)
                *
    ERROR at line 1:
    ORA-00036: maximum number of recursive SQL levels (50) exceeded
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_INS'
    ORA-06512: at "APC.T69_AFTER_INS", line 2
    ORA-04088: error during execution of trigger 'APC.T69_AFTER_I
    
    
    SQL>
    

    “Is there any way that I can update
    TableA based on info from TableB given
    an id that is in both tables? “

    If by “update” you actually do mean UPDATE, and – crucially – depending on the precise logic you wish to implement then perhaps yes:

    SQL> create or replace trigger t69_after_ins
      2      after insert on t69
      3  begin
      4      update t69
      5          set name = ( select name from t23
      6                       where t23.id = t69.id )
      7          where name is null;
      8  end;
      9  /
    
    Trigger created.
    
    SQL> insert into t69 (id, name) values (122, null)
      2  /
    
    1 row created.
    
    SQL> select name from t69
      2  where id = 122
      3  /
    
    NAME
    ----------
    MAISIE
    
    SQL>
    

    However this remains a bad idea. Triggers are hard to understand and can have a deleterious nimpact on the performance of our SQL. So I suggest you try to figure out a way of building your logic into the main body of your application, rather than trying to use a trigger.

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

Sidebar

Ask A Question

Stats

  • Questions 462k
  • Answers 462k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer sadly it is not possible via springs jmx exporter. Writing… May 16, 2026 at 12:23 am
  • Editorial Team
    Editorial Team added an answer What I did for this situation is add the source… May 16, 2026 at 12:23 am
  • Editorial Team
    Editorial Team added an answer So you need something like: public class User { ...… May 16, 2026 at 12:23 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.