Assigns specified value to a variable from the package.
The following example sets the new 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