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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:33:18+00:00 2026-05-25T17:33:18+00:00

I have a Stored Procedure that seems to be very slow. Executing it in

  • 0

I have a Stored Procedure that seems to be very slow.

Executing it in Oracle SQL Developer;

SET TIMING ON;

DECLARE
  CUR_OUT UTILS.T_CURSOR;
  P_ARTTYID NUMBER;
  P_ORDERST VARCHAR2(200);
  P_DRUMNO VARCHAR2(200);
  P_SHIPPINGNO VARCHAR2(200);
  P_DELIVERYDATEFROM DATE;
BEGIN
  P_ARTTYID := 2;
  P_ORDERST := '3';
  P_DRUMNO := '611-480';
  P_SHIPPINGNO := NULL;
  P_DELIVERYDATEFROM := '2005-01-01';

  C_T_ORDER_GETOVERVIEW(
    CUR_OUT => CUR_OUT,
    P_ARTTYID => P_ARTTYID,
    P_ORDERST => P_ORDERST,
    P_DRUMNO => P_DRUMNO,
    P_SHIPPINGNO => P_SHIPPINGNO,
    P_DELIVERYDATEFROM => P_DELIVERYDATEFROM
  );

  --DBMS_OUTPUT.PUT_LINE('CUR_OUT = ' || CUR_OUT); -- Doesn´t work ;|
END;

Gives the “Statement output”

anonymous block completed
139ms elapsed

Now the problem is when I call it from my VB.NET application using
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader() that returns a System.Data.IDataReader and the following function to convert the IDataReader to a DataSet.

    Public Shared Function ConvertIDataReaderToDataSet(ByVal reader As IDataReader) As DataSet
        Dim schemaTable As DataTable = reader.GetSchemaTable()
        Dim dataTable As DataTable = New DataTable

        For intCounter As Integer = 0 To schemaTable.Rows.Count - 1
            Dim dataRow As DataRow = schemaTable.Rows(intCounter)
            Dim columnName As String = CType(dataRow("ColumnName"), String)
            Dim column As DataColumn = New DataColumn(columnName, CType(dataRow("DataType"), Type))
            dataTable.Columns.Add(column)
        Next

        Dim dataSet As DataSet = New DataSet
        dataSet.Tables.Add(dataTable)

        'dataSet.Load(reader, LoadOption.OverwriteChanges, dataTable) ' DEBUG
        While reader.Read()
            Dim dataRow As DataRow = dataTable.NewRow()
            For intCounter As Integer = 0 To reader.FieldCount - 1
                dataRow(intCounter) = reader.GetValue(intCounter)
            Next
            dataTable.Rows.Add(dataRow)
        End While

        Return dataSet
    End Function

Debugging and stepping through the function ends at the line for “While reader.Read()”.
Also tried another version using DataSet.Load() but with the same result.

Found this thread on MSDN where others with the same problem seems to have solved it by tuning their queries by adding indexes.

How can I continue investigating the issue when it seems like the procedure works (responds within ~100 – 200ms) and the IDataReader.Read() just ends (or continues in the background?)

  • Can I time the procedure in another (better) way?
  • Can there be any table or transaction locks involved?

All advices are highly appreciated 🙂

  • 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-25T17:33:18+00:00Added an answer on May 25, 2026 at 5:33 pm

    Your test in SQL Developer is simply measuring the time required to open the cursor. Opening the cursor does not cause Oracle to actually execute the query– that does not happen until you fetch data from the cursor and each time you fetch, Oracle will continue processing the query to get the next set of rows. Oracle does not, in general, need to execute the entire query at any point in time. To be a comparable test, your PL/SQL block would need to fetch all the data from the cursor. Something like

    DECLARE
      CUR_OUT UTILS.T_CURSOR;
      P_ARTTYID NUMBER;
      P_ORDERST VARCHAR2(200);
      P_DRUMNO VARCHAR2(200);
      P_SHIPPINGNO VARCHAR2(200);
      P_DELIVERYDATEFROM DATE;
    BEGIN
      P_ARTTYID := 2;
      P_ORDERST := '3';
      P_DRUMNO := '611-480';
      P_SHIPPINGNO := NULL;
      P_DELIVERYDATEFROM := '2005-01-01';
    
      C_T_ORDER_GETOVERVIEW(
        CUR_OUT => CUR_OUT,
        P_ARTTYID => P_ARTTYID,
        P_ORDERST => P_ORDERST,
        P_DRUMNO => P_DRUMNO,
        P_SHIPPINGNO => P_SHIPPINGNO,
        P_DELIVERYDATEFROM => P_DELIVERYDATEFROM
      );
    
      LOOP
        FETCH cur_out
         INTO <<list of variables to fetch data into>>;
    
        EXIT WHEN cur_out%notfound;
      END LOOP;
    
      --DBMS_OUTPUT.PUT_LINE('CUR_OUT = ' || CUR_OUT); -- Doesn´t work ;|
    END;
    

    Are you saying that in your .Net code, the reader.Read() line never returns? Or are you saying your code aborts at that point?

    • 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 a stored procedure that is doing a MERGE. It seems given the
I have a stored procedure that runs custom backups for around 60 SQL servers
I have a stored procedure that is currently running, and seems to hang/lock on
I have a simple stored procedure in T-SQL that is instant when run from
I have a stored procedure that takes a user ID and calculates their balance
I have a stored procedure that takes no parameters, and it returns two fields.
I have a stored procedure that I want to call from within another, and
I have a stored procedure that logs some data, how can I call this
i have a stored procedure that performs a join of TableB to TableA :

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.