How do you pass parameters to a Pipelined function?

I am using Oracle 10G and the ODP .NET 32 bit client.
I am facing an issue trying to use variable binding with a pipeline function in Oracle. I am using ODP .NET for connecting to the database.
If you want to be familiar with PIPELINED functions, you can read [this  blog.|http://oradim.blogspot.com/2007/10/odpnet-tip-using-pipelined-functions.html]
I have very similar code with a difference. My function takes in two parameters that I need to pass to get the table. This is working in SQLPLUS without any issues.
In my C# code, however things change. My function no longer returns a recordset (data reader), if I use the standard method of assigning the parameters.
The code will work if I concat the variables in a string.
Here is the example that doesn't work.
        static OracleDataReader fetchData(OracleConnection oc, string strPONumber)
            try
                OracleCommand od = oc.CreateCommand();
                od.CommandType = System.Data.CommandType.Text;
                od.CommandText = "select * from table(pkg_fetchPOInfo.getPORowsTable(:1,:2))";
                OracleParameter op1 = new OracleParameter();
                op1.ParameterName = "1";
                op1.OracleDbType = OracleDbType.Varchar2;
                op1.Direction = System.Data.ParameterDirection.Input;
                op1.Size = 7;
                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);
                OracleDataReader or = od.ExecuteReader();
                return or;
            catch (Exception e)
                Console.WriteLine("Error " + e.ToString());
                return null;
        }Here is the example that does.
      static OracleDataReader fetchData(OracleConnection oc, string strPONumber)
            try
                OracleCommand od = oc.CreateCommand();
                string formSQL = "Select * from table(pkg_fetchPOInfo.getPORowsTable('"+strPONumber+"','US'))";
                od.CommandType = System.Data.CommandType.Text;
                od.CommandText = formSQL;
                OracleDataReader or = od.ExecuteReader();
                return or;
            catch (Exception e)
                Console.WriteLine("Error " + e.ToString());
                return null;
        }

throw it into an anonymous block and it should work for you.
--create or replace type varcharTableType as table   of varchar2 (4000);
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;
       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();
        }

Similar Messages

  • How can i pass parameters to every form sucessively or repeatedly

    How can i pass parameters to every form sucessively or repeatedly
    Eg: I have username which is specified in first form
    I want to display and use the username in each and every form after that form
    please tell me how to do
    i have one solution
    i.e., Normal way to pass parameters from one form to another!
    Is any procedure to pass paramters to all form at a time???

    excellent ...
    thanks for adding up to my post ..
    You can make use of parameters
    Every forms shud have same parameter name and u pass on the values of these
    Its one of the best ways

  • How can I pass parameters from one process flow to another process flow?

    How can I pass parameters from one process flow to another process flow (sub process) in warehouse builder? let me know the steps I have to do in warehouse builder.
    Thanks in advance,
    Kishan

    Hi Kishan,
    Please post this question to the Warehouse Builder forum:
    Warehouse Builder
    Thanks, Mark

  • How do I pass parameters to a report thru Report Viewer?

    hi,
    I am moving from Crystal Reports 8.5 to XI in VB6.
    How do I pass parameters to a report thru Report Viewer?
    Old VB code:
    crReport.ParameterFields(0) = "FrProp;" & Trim$(.FrProp) & ";TRUE"
    crReport.ParameterFields(1) = "ThProp;" & Trim$(.ThProp) & ";TRUE"
    crReport.ParameterFields(2) = "RunDate;date(" & Format(Cntl.Run_Date, "yyyy,mm,dd") & ");TRUE"
    crReport.ParameterFields(3) = "FrDate;date(" & Format(.FrDate, "yyyy,mm,dd") & ");TRUE"
    crReport.ParameterFields(4) = "ThDate;date(" & Format(.ThDate, "yyyy,mm,dd") & ");TRUE"
    Bill todd

    Hi Bill,
    Download sample code from the following link:[https://boc.sdn.sap.com/codesamples] 
    Hope this helps!!
    Regards,
    Shweta

  • How do you pass XML as a URL param?

    How do you pass XML as a URL param?
    Thanks!

    I don't know why I wasn't thinking about this when I made my
    last post. If they're pasting some XML into a form, that's one
    thing. But if they need to send XML to your site from their own,
    you can setup a Coldfusion Component (CFC) as a Web Service to
    accept XML through a WSDL call.
    Check out the
    Coldfusion
    Developers Center for
    articles
    on creating web services

  • How do you pass shell scripts with cocoa?

    How do you pass shell scripts with cocoa?

    You asked for more detail -- I don't know if this is what you were referring to or not, but here's a little more detail on how to use the system() function if that's what you wanted to know.
    As etresoft mentioned, the system() function can be useful for the kind of thing you are talking about. You will need to write the following statement at the top of your code if you want to use it:
    #include <stdlib.h>
    To use the system() function, simply put the command as you would write it in the Terminal between double quotes between the parenthesis. For example, something as simple as:
    system("ls");
    I don't what the practical use of the above statement would be, but it will run, and that's the general format for the system() function. So just put between the quotes whatever command you want to send.
    Hope there was something helpful here.

  • (264361962) Q ADVC-27 How do you pass the security info to access the EJB?

    Q<ADVC-27> How do you pass the security info to access the EJB?
    A<ADVC-27> Authentication for web service users must occur at the web layer. This
    means providing appropriate web resource definitions and restrictions in the web.xml
    file for your project. The most common and useful form of security for application
    interaction is via client-side certificates. Then the client identity is transmitted
    to the EJB is the same way as in regular J2EE environments. There is a complete description
    on security on e-docs:
    http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
    Adam

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (119093)

  • How I can pass parameters by POST method?

    How I can pass parameters by POST method?
    I use URL Template iView. I checked Requested Method - POST, but when I started the iView the program says:"It's a GET method!"
    I use httpServletRequest.getMethod()in the program.
    Environment: EP6 SP2
    Thank's! 

    Hi Kremena,
    the OSS stands for "Online Service System" - service.sap.com - messages or directly: service.sap.com/message.
    Hope it helps
    Detlev

  • TS1424 How do you fix a R6025 pure virtual function call error?  When I try to search for music, iTunes freezes & returns this message.

    How do you fix a R6025 pure virtual function call error?  When I try to search for music, iTunes freezes & returns this message.

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • How do i pass parameters from j2me to jsp?plz help

    hi everyone...
    i m doing my final year project
    can anyone plz tell me how to pass parameters like user name,password,etc.. from a j2me midlet to a jsp page running in tomcat server?
    i tried passing parameters in http connection through url as:
    String url="http://localhost:8080/example/test.jsp?name=abc";
    i need this info urgently as i am not able to proceed with my project... plz help
    any suggestions or references would be appreciated...
    thank u...
    regards,
    Rinzi

    JHD
    hi.
    you have written in URL i sperfectly right but if this is also not complete one.
    i.e url = "http://localhost:8080/dir/xxx.jsp?userName=jasmit&password=vala"
    now when u establishing connection i.e
    HttpConnection con = (HttpConnection) Connector.open(url,3);
    this will work as an declaration but if u want to send that parameter for that you have to get response from the server and that time only original connection is going to establish i.e
    when u r writting
    int responseCode = con.getResponseCode();
    if(reponseCode == 200)
    then ur parameter were passed to jsp page.
    in jsp page u have to get parameter using request class
    String userName = request.getParameter("userName").toString();
    String password = request.getParameter("password").toString();
    i hope this might solve ur problem.
    Regards,
    Jasmit vala
    [email protected]

  • How do you pass an ActiveX Variant from an external application to LabVIEW?

    Background: I created a LabVIEW ActiveX server. I can access it with my external application (Matlab). I have a control variable in my LabVIEW executable. I want to use Active X to set the value of my control variable from my external application.
    Documentation: The only reference in the documentation for this task is in the Using ActiveX with LabVIEW in the LabVIEW 2009 help. It simply says "Use the variant control and indicator to pass data to or from ActiveX controls." I also went through all the ActiveX examples in the example finder and did not find any vis that passed variables using ActiveX.
    Questions:
    What should my control variable look like in LabVIEW? Should it be a refnum, a variant, or a data type? Does it have to be wired to a vi connector?
    Do I need to do any magic on this variable, such as change its properties?
    How do I pass the value from my external application to the variable in my LabVIEW executable?
    Thank you.

    Hello Lyn,
     The control variable should be a refnum and it would have to be wired to Automation Open with the correct reference.
    Here are some great examples of using ActiveX Server in LabVIEW
    LabVIEW Executable Used as ActiveX Server in LabVIEW
    http://decibel.ni.com/content/docs/DOC-9647
     Calling ActiveX Code from LabVIEW
     http://decibel.ni.com/content/docs/DOC-9073
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation

  • How would you pass more than 255 args?

    I have an SFTP program that currently is only passed a single file. I am modifying it so that it will loop though an array of files to simulate an mput command. Originally I was just going to call the program with each file to be transferred as an argument but noticed the 255 argument limit. I am looking at potentially having 1500 - 2000 files to transfer at one time. I am just looking for advice on how this should be designed. One idea that was forwarded to me was to just create a listing of the files on the server and use that list file as my argument. Would this be the best approach for this issue?

    sdhalepaska wrote:
    georgemc wrote:
    sdhalepaska wrote:
    georgemc wrote:
    sdhalepaska wrote:
    georgemc wrote:
    I see no reason why you need an argument for every file.I would not necessarily need one for every file. Prior to our needing to use this for multiple files, it was easy enough to pass in one file as an argument. That is my question, how would you try to pass in a long list of files?Let's establish what you are concerned about. The 255 argument limit is on method signatures. From what you're saying here, you're talking about arguments being passed into your application from, say, the shell. Am I right?Correct, please see my clarified post. From what I have tested, the 255 argument limit appears to exist even for arguments passed to main.Ah, but arguments passed to main from the command line are passed into main as a single array of Strings, no matter how many of them there are. I have no idea what the limit on those is, but an array can hold millions of elements. I expect your shell will moan about that many, though.
    As I see it, you have a few choices. Unless these files are all in different, arbitrary directories, you can specify a list of directories for your app to search. Or you can pass them all in one at a time, and see how you go. Or you can list them in a text file, pass that to your app and have it work them out. Or write a script that invokes your app multiple times. What you don't need, is a method that takes each file as an argument.Thank you for walking me through this. Would you mind telling me which way you would lean if you were designing this? The files will all be in a single directory on the server and I would not like to invoke the app multiple times as it creates a connection during each invocation. They're all in the single directory. Ok, are all the files in that directory to be transferred? If so, I'd just pass the directory name to the app, and have it iterate over all the files. If it's only to be certain ones, how do you know which ones? Is there some regex or filtering you can do on the command line?
    If you are interested, the 255 argument limit for main that I tested was from this article:
    [http://www.javaspecialists.eu/archive/Issue059.html|http://www.javaspecialists.eu/archive/Issue059.html]
    It does die at 255 using Java 1.5.Like I said, arguments to a method are thus limited. But the args passed to an app are passed to main as one argument - an array. In short, that article is not relevant to your problem.

  • JavaScript:  How do you pass the currently active doc to a dialog in a menu item?

    I'm using Adobe Acrobat 11.0 Standard on Windows 7, and I'm having trouble with the menu item that I'm creating.  The menu item calls a dialog that prompts the user to select a page in the currently active document.  The problem is, I can't figure out how to pass the currently active document to the dialog.  I scoured the rest of the documentation, did searches on Google and here in the Adobe forums, but haven't turned anything up.  The AcroJS API gives the following solution (found under app/methods/execDialog):
    This function attaches the Doc object to the dialog box, then passes the dialog box to the app.execDialog method. The dialog4 object and this function can be at the document level.
       function dotheDialog(dialog,doc)
            dialog.doc = doc;
            var retn = app.execDialog( dialog )
    Finally, the following script can be executed from a mouse-up action, for example.
        dotheDialog( dialog4, this );
    I did this exact thing, but in the dialog, the value of this.numPages still comes out as undefined, indicating that the current document still hasn't been passed.  My own code looks like this:
      function dotheDialog(dialog, thisDoc){
        dialog.doc = thisDoc;
        var retn = app.execDialog(dialog);
      app.addMenuItem({
        cName: "Test Dialogue Box",
        cParent: "Edit",
        cExec: "dotheDialog(templateDialogue, this);"
    where templateDialogue is the name of my own dialog, rather than dialog4.  I'm not sure what the retn variable that they declare in the documentation is for, but I've tried it with and without that part, and it doesn't seem to make a difference.  Does anyone know how to do this?

    Sorry, here it is.  It's also just a small modification of something directly from the API, which is why it still has the date bit in it.
    var templateDialogue = {
      initialize: function (dialog) {
        // Create a static text containing the current date.
        var todayDate = dialog.store()["date"];
        todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
        dialog.load({ "date": todayDate });
      commit:function (dialog) {    // called when OK pressed
        var results = dialog.store();
        var inBounds = (parseInt(results["tPag"]) < this.numPages);
        if(!inBounds){
          app.alert({
            cMsg: "Please enter a valid number for the page from which to make the template." +
            "\n" + parseInt(results['tPag']) + " = parseInt(results['tPag']) !< this.numPages = " +  // I put this in to see the value of this.numPages,
            this.numPages,                                                                           // and it continues to be undefined.
            cTitle: "Page out of Bounds",
            nIcon: 0, nType: 0
        }else{
          var nButton = app.alert({
            cMsg: "Your template is named " + results["tNam"] + " and is made from page " + results["tPag"],
            cTitle: "javascript",
            nIcon: 3, cType: 0
      description:    {
        name: "Personal Data",    // Dialog box title
        align_children: "align_left",
        width: 350,
        height: 200,
        elements:
            type: "cluster",
            name: "Add a page to this documents templates.",
            align_children: "align_left",
            elements:
                type: "view",
                align_children: "align_row",
                elements:
                    type: "static_text",
                    name: "Template Name: "
                    item_id: "tNam",
                    type: "edit_text",
                    alignment: "align_fill",
                    width: 300,
                    height: 20
                type: "view",
                align_children: "align_row",
                elements:
                    type: "static_text",
                    name: "Generating Page: "
                    item_id: "tPag",
                    type: "edit_text",
                    alignment: "align_fill",
                    width: 300,
                    height: 20
                type: "static_text",
                name: "Date: ",
                char_width: 25,
                item_id: "date"
            alignment: "align_right",
            type: "ok_cancel",
            ok_name: "Ok",
            cancel_name: "Cancel"
    Side Question:  Out of curiosity, how would you abort if the user clicks cancel?  I get the feeling that they don't cover it because it's something you're supposed to already know how to do, but...I don't.  Would you just put whatever action you want to take into an if ( button == "Ok" ) type statement so that cancel does nothing?

  • How do I pass parameters in Dynamic Pages ????!!!!!!

    I have 4 dynamic pages, a user enters in variables on first page. At the next 3 dynamic pages I send the user to I have to display the items they entered on the first page in text items.
    How do I pass these variables ????
    thanks!
    null

    You could use somethings like this:
    <script>
    function setupInventoryReportURL(anchor) {
         var choice = document.getElementById('supplierCenter:inventory:categoryChooser');
         if (choice) {
              var url ='inventoryRPT.jsf' + '?currentCategoryName=' + choice.options[choice.selectedIndex].text;
              anchor.href = url;
         return true;
    </script>
    <h:form id="inventory">
         <h:panelGrid columns="1" border="1" cellpadding="5">
              <f:facet name="header">
                   <h:panelGrid columns="2" width="100%">
                        <h:outputText value="Inventory"/>
                        <h:outputLink value="inventoryRPT.jsf" onclick="setupInventoryReportURL(this)">
                             <h:outputText value="Report" styleClass="commandLink"/>
                        </h:outputLink>
                   </h:panelGrid>
              </f:facet>
    <h:panelGrid columns="2" width="100%">
         <h:panelGroup>
              <h:outputText value="Supply Category"/>
              <h:selectOneMenu id="categoryChooser" value="#{inventory.categoryId}" onchange="submit()"
              valueChangeListener="#{inventoryView.categoryChanged}" immediate="true">
              <f:selectItems value="#{inventory.categories}"/>
         </h:selectOneMenu>
             ..............................................Vladimir Perlov

  • How do you pass a string into xml

    How do we pass a string to be parsed as xml
    something like
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    oc = docBuilder.parse (String s);
    Thanks
    Arnold

    String xmlString = "<?xml version=\"1.0\"?>\n<myelement myattribute=\"myvalue\"/>\n";
    InputSource inputSource = new InputSource(new StringReader(xmlString));
    Document document = builder.parse(inputSource);

Maybe you are looking for