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

  • Home
  • SEARCH
  • 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 835905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:53:52+00:00 2026-05-15T04:53:52+00:00

I have a trigger that’s throwing an error, and I am not sure how

  • 0

I have a trigger that’s throwing an error, and I am not sure how to know which line of PL/SQL code is throwing that error. My error is

[Oracle]ORA-01403: no data found
ORA-06512: at
“MYSCHEMA.FOO_BI”, line 9

My trigger is something like this:

create or replace TRIGGER "MYSCHEMA"."FOO_BI" 
BEFORE INSERT ON FOO REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
DECLARE
 NUM1 NUMBER;
 NUM2 NUMBER;

BEGIN

     -- some comment
  if :new.batch_num is null then
   SELECT COUNT(*) INTO :NEW.BATCH_NUM FROM FOO WHERE CORP_ID = :NEW.CORP_ID;
  end if;

  if :new.batch_id is null or :new.batch_id = '' then
    :NEW.BATCH_ID := :NEW.CORP_ID || '-' || :NEW.BATCH_NUM;
  end if;

/* etc... */     

I found what looks like a similar question but the line numbering starts with the create or replace... and represents my error line as a comment, which I think must be bogus. How is the line numbering reported when an error is thrown in execution of a trigger?

  • 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-15T04:53:52+00:00Added an answer on May 15, 2026 at 4:53 am

    The line numbering (as reported in stack traces) starts with the DECLARE being line 1. So, if you do the following:

    CREATE OR REPLACE TRIGGER foo
    BEFORE INSERT ON test1 
    REFERENCING OLD AS OLD NEW AS NEW 
    FOR EACH ROW
    DECLARE
    n1 NUMBER := 1;
    n2 NUMBER := 2;
    
    BEGIN
    
      -- a comment
      IF :new.n1 IS NULL THEN
        n1 := n2/0;
      END IF;
    END;
    /
    
    SQL> insert into test1 values (3,'XX','YY',NULL);
    
    insert into test1 values (3,'XX','YY',NULL)
    
    ORA-01476: divisor is equal to zero
    ORA-06512: at "XXX.FOO", line 9
    ORA-04088: error during execution of trigger 'XXX.FOO'
    
    SQL> select line, text from all_source where name = 'FOO';
    
          LINE TEXT
    ---------- --------------------------------------------------------------------------------
             1 TRIGGER foo
             2 BEFORE INSERT ON test1
             3 REFERENCING OLD AS OLD NEW AS NEW
             4 FOR EACH ROW
             5 DECLARE
             6 n1 NUMBER := 1;
             7 n2 NUMBER := 2;
             8 
             9 BEGIN
            10 
            11   -- a comment
            12   IF :new.n1 IS NULL THEN
            13     n1 := n2/0;
            14   END IF;
            15 END;
    
    15 rows selected
    

    You can see the error was reported as happening at line 9, which is actually line 13 in the source.

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

Sidebar

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.