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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:24:37+00:00 2026-05-28T04:24:37+00:00

I am learning PL/SQL these days and currently working with Procedures and exceptions using

  • 0

I am learning PL/SQL these days and currently working with Procedures and exceptions using oracle HR schema.

Here is my simple procedure.

create or replace
PROCEDURE DEL_JOB
(p_jobid jobs.job_id%TYPE)
AS 
sqle NUMBER; 
sqlm VARCHAR2(300);
BEGIN
DELETE FROM JOBS 
WHERE JOB_ID = UPPER(p_jobid);
IF SQL%NOTFOUND THEN
  DBMS_OUTPUT.PUT_LINE('No such record');
END IF;
EXCEPTION
 WHEN OTHERS THEN
  sqle := SQLCODE;
  sqlm := SQLERRM;
  DBMS_OUTPUT.PUT_LINE('There is no job with this id that could be deleted');
  DBMS_OUTPUT.PUT_LINE('Error Code ='||sqle||' Error message =' ||sqlm);
END;

When I execute this procedure the output is

  No such record
  PL/SQL procedure successfully complete. 

However, according to the Oracle PDF it should throw an exception and I should really get the message I entered in the exception.

Same thing happened with the Update on non existing record.
Please advise. 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-28T04:24:38+00:00Added an answer on May 28, 2026 at 4:24 am

    I believe SQL%NOTFOUND returns true when no records are found. Your IF would evaluate to true in that case, and therefore write your put_line to terminal. The SQL statement executed successfully. If you execute that SQL statement by itself from command line, you will receive 0 rows updated/deleted, not an Oracle error.

    If you want to have an exception thrown, you could use RAISE inside your IF and point it to the exception in the exception block you want to have thrown.

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

Sidebar

Related Questions

I'm learning about table design in SQL and I'm wonder how to create a
I'm considering spending time learning and using LINQ to SQL but after years of
Excuse me but I am very new at learning to use oracle and sql.
I just started learning SQL a couple of days ago, and I'm trying to
I'm learning databases, using SqlCe, and need business object to database mapping. Currently I
I am new to SQL Server and currently learning it. I got following stored
I am currently learning how to program in SQL. I have a table1 with
I am using sql-server 2005. Initially, for learning purpose I created many tables now
When learning the C# language. With all the applications being developed these days. Would
I have been slowly learning SQL the last few weeks. I've picked up all

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.