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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:43:45+00:00 2026-05-16T03:43:45+00:00

I have an Oracle function that returns a record set. I introduced parameters to

  • 0

I have an Oracle function that returns a record set.
I introduced parameters to the Oracle function and this is causing the front-end code to go haywire.

Here’s my front-end code.

 OracleCommand od = oc.CreateCommand();
            od.CommandType = System.Data.CommandType.Text;
            od.CommandText = " select * from table(pkg_fetchPOInfo.getPORowsTable(:1,:2))";
            //od.CommandText = "pkg_fetchPOInfo.getPORowsTable";
            //od.CommandType = System.Data.CommandType.TableDirect;

            OracleParameter op1 = new OracleParameter();
            op1.ParameterName = "1";
            op1.OracleDbType = OracleDbType.Varchar2;
            op1.Direction = System.Data.ParameterDirection.Input;
            op1.Size = 6;
            op1.Value = strPONumber;
            od.Parameters.Add(op1);

            OracleParameter op2 = new OracleParameter();
            op2.ParameterName = "2";
            op2.OracleDbType = OracleDbType.Varchar2;
            op2.Direction = System.Data.ParameterDirection.Input;
            op2.Size = 3;
            op2.Value = "US";
            od.Parameters.Add(op2);

If I execute the query in the front-end SQLPLUS, I get a recordset.
This code works if I remove the parameters from the package and the front-end code.

select * from table(pkg_fetchPOInfo.getPORowsTable(‘1007446′,’US’)); –works in SQLPLUS.

select * from table(pkg_fetchPOInfo.getPORowsTable()); –works in both places.

Am I assigning the parameters incorrectly?

  • 1 1 Answer
  • 2 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-16T03:43:46+00:00Added an answer on May 16, 2026 at 3:43 am

    Package Definition:

    CREATE OR REPLACE 
    PACKAGE TESTP AS
        function TESTPIPE(nr in number, nr2 in number) return varchartabletype pipelined;
    END TESTP;
    
    CREATE OR REPLACE
    PACKAGE BODY TESTP AS
    
        function TESTPIPE(nr in number, nr2 in number) return varchartabletype pipelined AS
            CURSOR TESTPIPE_cur
            IS
                SELECT (level + 1) datam
                FROM dual
                connect by level < nr;
            vtt varchartabletype ;
    
        BEGIN
                OPEN TESTPIPE_cur;
    
                LOOP
                    FETCH testpipe_cur
                    BULK COLLECT INTO vtt LIMIT nr2;
    
                    FOR indx IN 1 .. vtt.COUNT
                    LOOP
                        Pipe Row ( vtt( indx ) )  ;
                    END LOOP;
    
                    EXIT WHEN testpipe_cur%NOTFOUND;
                END LOOP;
    
        END TESTPIPE;
    
    END TESTP;
    

    .NET Code:

    public static void pipeTest()
    {
        String conString = GetConnectionString();
        OracleConnection _conn = new OracleConnection(conString);
        _conn.Open();
        OracleCommand oCmd = new OracleCommand();
        oCmd.CommandText = "begin open :crs for Select * from table(testp.testpipe(:nr,:nr2)); end;";
    
        oCmd.CommandType = CommandType.Text ;
        oCmd.Connection = _conn;
    
        OracleParameter crs = new OracleParameter();
        crs.OracleDbType = OracleDbType.RefCursor;
        crs.Direction = ParameterDirection.Output;
        crs.ParameterName = "crs";
        oCmd.Parameters.Add(crs);
    
        OracleParameter nr = new OracleParameter();
        nr.OracleDbType = OracleDbType.Int64;
        nr.Direction = ParameterDirection.Input ;
        nr.ParameterName = "nr";
        nr.Value = 25;
        oCmd.Parameters.Add(nr);
    
        OracleParameter nr2 = new OracleParameter();
        nr2.OracleDbType = OracleDbType.Int64;
        nr2.Direction = ParameterDirection.Input;
        nr2.ParameterName = "nr2";
        nr2.Value = 10;
        oCmd.Parameters.Add(nr2);
    
        using (OracleDataReader MyReader = oCmd.ExecuteReader())
        {
            int ColumnCount = MyReader.FieldCount;
            // get the data and add the row
            while (MyReader.Read())
            {
                String s = MyReader.GetOracleValue(0).ToString();
                Console.WriteLine(string.Format("i={0}", s));
            }
        }
        Console.ReadLine();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in Oracle that returns a sequence number. When I try
I have an Oracle 10g function, named 'F_SMART_DATE()', that returns a scalar DATE. It
I have a VB.Net function which executes a Oracle Stored Proc and returns a
Ok this is the scenario... I have a table in Oracle that acts like
I currently have the following funciton in an oracle database that returns a concatenated
I have Oracle Package named DEF , with 1 function inside named ABC that
I have a function that inserts a chunk of data into oracle database. I'm
I need function, that returns list of strings. I have data in table like
I have a table in oracle that looks like this: name | type |
I have the following bit of code that reads data from the an Oracle

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.