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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:58:01+00:00 2026-06-14T22:58:01+00:00

I created a plsql program to get an employee_id from substitution variable. whenever i

  • 0

I created a plsql program to get an employee_id from substitution variable. whenever i try to input a letter, i get an error message with ORA-06550 as the error number. I put it in the exception section but it seems like it wasn’t being raised.

here’s the error message when i input ‘kk’ in the substitution variable…

Error report:
ORA-06550: line 13, column 9:
PLS-00201: identifier 'KK' must be declared
ORA-06550: line 13, column 1:
PL/SQL: Statement ignored
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:

and here’s my pl/sql block

set serveroutput on
set verify off
declare
  cursor cur(mid employees.employee_id%type) is
  select e.last_name employee, 
         m.last_name manager 
    from employees e 
    join employees m 
      on m.employee_id = e.manager_id
   where m.employee_id=mid;

   rec cur%rowtype;
   m_id employees.employee_id%type;
   ex exception;
   pragma exception_init(ex, -06550);

begin
  m_id := &id;
  open cur(m_id);
  fetch cur into rec;
    dbms_output.put_line('here '||rec.employee || ' ' || rec.manager);
  close cur;

exception
  when ex then dbms_output.put_line('employee_id was not a valid number');
end;
/

do anyone knows why i cant trap that exception?

  • 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-14T22:58:02+00:00Added an answer on June 14, 2026 at 10:58 pm

    I wish I could comment. Can’t you change your code to:

    m_id := '&id';
    

    so you won’t need to trap that exception.

    Update for catching number exception:

    declare
        (...)
    begin
        m_id := to_number('&id');
        (...)
    exception
        when VALUE_ERROR then
             dbms_output.put_line('You provided invalid number'); 
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Created .NET WCF service, tested it - works. Generated schemas from Data and service
How can I get a procedure/function name where an exception occurs in PLSQL? I
I'm trying to return sequence.nextval to my program from a proc stored in a
I have a plsql procedure to delete records from child and parent tables. I
I have created an office scheduling program that uses jQuery to post to a
I'm following a tutorial on PL/SQL http://www.plsqltutorial.com/plsql-procedure/ . I have created procedure with the
I have run into an interesting error. I have created a PL/SQL Webservice in
I am new to PostgreSQL and I try to get my head around it.
I created a plsql function and I want to create a cursor and return
I need at some point to increment dynamically a timestamp plsql variable. So, instead

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.