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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:30:51+00:00 2026-06-18T08:30:51+00:00

Being still a newbie in PL/SQL, I’ve been copying and pasting around the following

  • 0

Being still a newbie in PL/SQL, I’ve been copying and pasting around the following trigger:

CREATE OR REPLACE TRIGGER FOO_TRG1
    BEFORE INSERT
    ON FOO
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
BEGIN
    IF :NEW.FOO_ID IS NULL THEN
        SELECT FOO_SEQ1.NEXTVAL INTO :NEW.FOO_ID FROM DUAL;
    END IF;

    EXCEPTION
        WHEN OTHERS THEN RAISE;
END FOO_TRG1;
/
ALTER TRIGGER FOO_TRG1 ENABLE;

I suspect that the included exception handling code does nothing at all and could simply get removed, since I’ll get an error message anyway if something goes wrong. Am I right?

(I guess such code is the result of further editing prior code.)

  • 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-18T08:30:52+00:00Added an answer on June 18, 2026 at 8:30 am

    yes, that exception does nothing but raise the same error out. also it serves to mask the real line number of the error. i’d remove that if I were you.

    eg:

    SQL> declare
      2    v number;
      3  begin
      4    select 1 into v from dual;
      5    select 'a' into v from dual;
      6  exception
      7    when others
      8    then
      9      raise;
     10  end;
     11  /
    declare
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 9
    

    vs:

    SQL> declare
      2    v number;
      3  begin
      4    select 1 into v from dual;
      5    select 'a' into v from dual;
      6  end;
      7  /
    declare
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 5
    

    the line number in the first one is pointing to the raise instead of the real line number. it can make tracking down errors harder.

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

Sidebar

Related Questions

The apply phase of save may fail and/or is still being done asynchronously before
I'm a newbie in the realm of SQL still, so I have a question
I've been hunting around for a few hours and I still have no idea
I am still a newbie.So that being said, my site has a messaging system
Being a self-taught newbie, I created a large problem for myself. Before inserting data
Being a newbie I have read forums and posts but still can't work out
I'm still a newbie to Adobe Air/Flex, and still fairly new with SQL. I've
I'm trying to center a page on any resolution while still being able to
ive being trying to cope with this problem but still. I need your help.
guys sorry for being so noob but im still starting yet with my php,

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.