This method executes a command using the XmlCommandType and CommandText properties and appends the result as an XML document to the existing Stream provided by the application.


// C#
public void ExecuteToStream(Stream outputStream);


  • outputStream

    A Stream.


The behavior of ExecuteToStream varies depending on the XmlCommandType property value:

  • XmlCommandType = OracleXmlCommandType.None

    ExecuteToStream throws an InvalidOperationException.

  • XmlCommandType = OracleXmlCommandType.Query

    ExecuteToStream executes the select statement in the CommandText property, and if successful, appends the XML document that was generated to the given Stream.

    If the SQL query does not return any rows, then nothing is appended to the given Stream. The character set of the appended data is Unicode.

  • XmlCommandType = OracleXmlCommandType.Insert, OracleXmlCommandType.Update, or OracleXmlCommandType.Delete

    The value of the CommandText property is an XML document. ExecuteToStream saves the changes in that XML document to the table or view that is specified in the XmlSaveProperties property. Nothing is appended to the given Stream.