dotConnect for Oracle Documentation
Devart.Data.Oracle Namespace / OraclePackage Class
Members Example

OraclePackage Class
Provides access to packages stored in the Oracle database.
Syntax
'Declaration
 
Public Class OraclePackage 
   Inherits System.ComponentModel.Component
   Implements System.ComponentModel.IComponentSystem.IDisposable 
 
Remarks
Use OraclePackage component to get access to packages stored in the Oracle database. Packages may encapsulate sets of procedures and functions along with related variables and constants. For a list of Oracle supplied packages refer to Oracle online documents.

This class is available only in Professional and Developer Editions. It is not available in Standard and Mobile Editions.

Example
The following example executes procedure with/without parameters and returns value.
public void ExecuteStoredProc(OracleConnection conn)
{
  OraclePackage package = new OraclePackage();

  // Set active connection
  // Connection must be opened
  package.Connection = conn;

  // Set package name where stored procedure exists
  package.PackageName = "dbms_random";

  // Execute procedure with parameters
  package.ExecuteProcedure("initialize", 10);

  // Execute procedure and return value
  object randomInt = package.ExecuteProcedure("random",typeof(Int));

  // Print returned value
  Console.WriteLine(randomInt);

  // Execute procedure without parameters
  package.ExecuteProcedure("terminate");
}
Public Sub ExecuteStoredProc(conn As OracleConnection)
  Dim package As New OraclePackage()

  ' Set active connection
  ' Connection must be opened
  package.Connection = conn

  ' Set package name where stored procedure exists
  package.PackageName = "dbms_random"

  ' Execute procedure with parameters
  package.ExecuteProcedure("initialize", 10)

  ' Execute procedure and return value
  Dim randomInt As Object
  randomInt = package.ExecuteProcedure("random", GetType(Int))

  ' Print returned value
  Console.WriteLine(randomInt)

  ' Execute procedure without parameters
  package.ExecuteProcedure("terminate")
End Sub ' ExecuteStoredProc
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         Devart.Data.Oracle.OraclePackage

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also