locked
XML TYPE INPUT & OUTPUT PARAMS FOR A ORACLE FUNCTION WITH EXECUTENONQUERY() RRS feed

  • Question

  • Hi all,

    I'm working on .net with oracle 10g client. I have a problem while executing a oracle function which takes xmltype parameter as input and also gives xmltype output param.

    my XML input(xmltype) is

    <EVENT>
    <REQUEST ID=12345 E_USER="ADMIN" E_APP="TEST" E_REF=""/>
    <E_DTLS E_TYPE="1" A_TYPE ="V"/>
    </EVENT>


    cmd.Parameters.Add(new OracleParameter("IP_REQUEST_OBJECT_X", OracleDbType.XmlType, ParameterDirection.Input));
    cmd.Parameters["IP_REQUEST_OBJECT_X"].Value = strXML;

    OracleParameter outparam1 = new OracleParameter("OP_RESPONSE_OBJECT_X", OracleDbType.XmlType);
    outparam1.Direction = ParameterDirection.Output;
    cmd.Parameters.Add(outparam1);


    Now I'm getting the below error while executing the function at cmd.ExecuteNonQuery();

    System.InvalidOperationException: Operation is not valid due to the current state of the object.
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()


    Is thr any wrong passing of xml as input in my code ?

    Pls help. It's very urgent for my Project.

    Thanks,

    Anil

    • Moved by Guo Surfer Friday, March 20, 2009 6:00 AM off topic (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
    Monday, March 16, 2009 10:19 AM

Answers

  • Hi Anil,

    Please consider posting your thread to ODP.NET Forum. You may get quicker and better responses there.
    Thank you!

    Best regards,
    Guo
    Wednesday, March 18, 2009 6:44 AM
  • Hi Anil,

    There are two things you should look at:

    1. Are you calling connection.Open() method before you make call to databse??? That's probably your problem.

    2. In general, ExecuteNonQuery does not expect anything back from database. Try using some other function if you could.

    Let us know if that helped.

    Thanks,
    Viral.
    Wednesday, March 18, 2009 8:15 AM
  • This was moved out of the VC# forum.

    You can ask this in the Oracle forum (as suggested).

    Or I can move it into a specific MSDN forum if you'd like.

    This is regarding your code:

    <EVENT>
    <REQUEST ID=12345 E_USER="ADMIN" E_APP="TEST" E_REF=""/>
    <E_DTLS E_TYPE="1" A_TYPE ="V"/>
    </EVENT>
    

     

    Thanks!
    Ed Price a.k.a User Ed, Microsoft Experience Program Manager (Blog, Twitter, Wiki)
    Friday, December 30, 2011 6:12 PM

All replies

  • Hi Anil,

    Please consider posting your thread to ODP.NET Forum. You may get quicker and better responses there.
    Thank you!

    Best regards,
    Guo
    Wednesday, March 18, 2009 6:44 AM
  • Hi Anil,

    There are two things you should look at:

    1. Are you calling connection.Open() method before you make call to databse??? That's probably your problem.

    2. In general, ExecuteNonQuery does not expect anything back from database. Try using some other function if you could.

    Let us know if that helped.

    Thanks,
    Viral.
    Wednesday, March 18, 2009 8:15 AM
  • This was moved out of the VC# forum.

    You can ask this in the Oracle forum (as suggested).

    Or I can move it into a specific MSDN forum if you'd like.

    This is regarding your code:

    <EVENT>
    <REQUEST ID=12345 E_USER="ADMIN" E_APP="TEST" E_REF=""/>
    <E_DTLS E_TYPE="1" A_TYPE ="V"/>
    </EVENT>
    

     

    Thanks!
    Ed Price a.k.a User Ed, Microsoft Experience Program Manager (Blog, Twitter, Wiki)
    Friday, December 30, 2011 6:12 PM