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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:14:43+00:00 2026-06-02T06:14:43+00:00

In Oracle I have a stored procedure that queries a table and writes 2

  • 0

In Oracle I have a stored procedure that queries a table and writes 2 fields into variables. Problem is Oracle will throw an error when nothing is returned. Here is my code

  SELECT COUNT (empno),Name
    INTO empcount,empname
    FROM lv_request_header
   WHERE empno = emp 
     AND request_id = rqid
   GROUP BY empname

Using NVL with a count still throws an error

ERROR at line 1: ORA-20000: lv_request_header not found ORA-06512: at line 13

  • 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-02T06:14:44+00:00Added an answer on June 2, 2026 at 6:14 am

    The error you posted indicates that the problem is that the table lv_request_header does not exist or that the owner of the procedure does not have access to it. If a user other than the owner of the procedure owns this table, you likely need to qualify the table name with the schema name or to create a synonym for the object.

    In general, if you want to deal with a SELECT ... INTO statement that returns 0 rows, you’d need to specify what values you want your two local variables to have in that case. If you want empcount to be 0 and empname to be NULL, you could do something like this

    BEGIN
      SELECT COUNT (empno),Name
        INTO empcount,empname
        FROM lv_request_header
       WHERE empno = emp 
         AND request_id = rqid
       GROUP BY empname
    EXCEPTION
      WHEN no_data_found
      THEN
        empcount := 0;
        empname  := NULL;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem Conditions I have a very simple Oracle (11g) Stored Procedure that is declared
I have the following iBatis mapping for an Oracle Stored Procedure that returns a
I have this stored procedure for Oracle: create or replace procedure bns_saa_message_get() <--- PROBLEM
I have an Oracle stored procedure that returns a BLOB in an output parameter:
I have a stored procedure in Oracle that returns result set(s) via OUT parameter(s)
I have an Oracle trigger which is calling a stored procedure that has PRAGMA
I have to call a stored procedure from oracle sever that not under our
I am using Oracle 10g and I have the following stored procedure: CREATE OR
I am developing a PL/SQL stored procedure which inserts rows into a table. The
I have a stored procedure that goes something like this (pseudo code) storedprocedure param1,

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.