Returns a value of the variable in the package mapped to the specified type.
Parameters
- variableName
- Name of the variable in the package.
- dbType
- One of the OracleDbType values.
Return Value
A value of the variable in the package.
The following example obtains and then prints the variable value.
public void GetPackageVariableValue(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 = "oranet_pack";
// Get variable value
object pkgVar = package.GetVariable("package_variable", OracleDbType.VarChar);
// Print variable value
Console.WriteLine(pkgVar);
// Set variable to specific value
package.SetVariable("package_variable", "test string");
// Get variable value
pkgVar = package.GetVariable("package_variable", OracleDbType.VarChar);
// Print variable value
Console.WriteLine(pkgVar);
}
Public Sub GetPackageVariableValue(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 = "oranet_pack"
' Get variable value
Dim pkgVar As Object
pkgVar = package.GetVariable("package_variable", OracleDbType.VarChar)
' Print variable value
Console.WriteLine(pkgVar)
' Set variable to specific value
package.SetVariable("package_variable", "test string")
' Get variable value
pkgVar = package.GetVariable("package_variable", OracleDbType.VarChar)
' Print variable value
Console.WriteLine(pkgVar)
End Sub 'GetPackageVariableValue
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