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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:33:03+00:00 2026-05-17T20:33:03+00:00

I have 2 procedures (A,B) in Oracle 9i. In individual, they all work fine.

  • 0

I have 2 procedures (A,B) in Oracle 9i. In individual, they all work fine. But I cannot make a procedure C that calls A, which in turn calls B. I put a dbms_output.put_line before C calls A, before A calls B and one in B. Somehow, only the first put_line works. What are the possible reasons why this doesn’t work? Thank you,

CREATE OR REPLACE PROCEDURE C (num in number)
as
begin
    for r in (select col1 from Table1)
    loop
        dbms_output.put_line ('Inside C');
        A(r.col1);
    end loop;
end;

CREATE OR REPLACE PROCEDURE A (var1 IN varchar2)
AS
    v1 varchar2;
    cursor c1(c_var in varchar2) is 
       select col1 from table2 where col2=c_var;
BEGIN
    open c1(var1);
    loop
        fetch c1 into v1;
        exit when c1%notfound; 
        dbms_output.put_line ('Inside A');
        B(v1);
    end loop;
    close c1;
END;
  • 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-17T20:33:03+00:00Added an answer on May 17, 2026 at 8:33 pm

    Obviusly, cursor c1 is empty, so your condition (exit when c1%notfound) is true and loop is terminated before the dbms_output call.

    If you want to print the line regardless of a empty cursor, change it’s position, for example:

    CREATE OR REPLACE PROCEDURE C (num in number)
    as
    begin
        dbms_output.put_line ('Inside C');
        for r in (select col1 from Table1)
        loop
            dbms_output.put_line ('Calling A');
            A(r.col1);
        end loop;
    end;
    
    
    CREATE OR REPLACE PROCEDURE A (var1 IN varchar2)
    AS
        v1 varchar2;
        cursor c1(c_var in varchar2) is
           select col1 from table2 where col2=c_var;
    BEGIN
        dbms_output.put_line ('Inside A');
        open c1(var1);
        loop
            fetch c1 into v1;
            exit when c1%notfound;
            dbms_output.put_line ('Calling B');
            B(v1);
        end loop;
        close c1;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wrapper procedure(proc_main) that calls some procedures within. create or replace Procedure
We have an internal application based on .Net which calls certain procedures in Oracle
I have a question about stored procedures in Oracle. Below is the stored procedure
I have a Oracle procedure to which I have to pass a datetime value
I have a stored procedure in oracle which is using cursor.Its fetching the data
I have a situation where I have an Oracle procedure that is being called
I have the following iBatis mapping for an Oracle Stored Procedure that returns a
I have a .net web application that makes heavy use of oracle stored procedures.
I have to import a stored procedure from Oracle database into Informatica. But when
Background - I have a client that has an Oracle database with many procedures

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.