Provides access to packages stored in the Oracle database.
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
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