Oracle® Objects for OLE Developer's Guide 11g Release 2 (11.2) for Microsoft Windows Part Number E17727-03 |
|
|
PDF · Mobi · ePub |
Returns an integer indicating the status of the specified parameter. Not available at design time and read-only at run time.
parameter_status = oraparameter.Statusparameter_status = oraparamarray.Status
Integer
The Status
property is interpreted as a series of bits, each providing information about the parameter. Parameters can be bound only if they are enabled, and can be enabled only if they are auto-enabled.
The parameter Status
property bit values are:
Constant | Value | Description |
---|---|---|
ORAPSTAT_INPUT |
&H1& |
Parameter can be used for input. |
ORAPSTAT_OUTPUT |
&H2& |
Parameter can be used for output. |
ORAPSTAT_AUTOENABLE |
&H4& |
Parameter is AutoBindEnabled. |
ORAPSTAT_ENABLE |
&H8& |
Parameter is Enabled. This bit is always set. |
These values are located in the ORACLE_BASE\\ORACLE_HOME
\oo4o\oraconst.txt
file.
This example demonstrates the use of parameters and the ExecuteSQL
method to call a stored procedure (located in ORAEXAMP.SQL
). After calling the stored procedure, the Status
property of each parameter is checked. Copy and paste this code into the definition section of a form. Then, press F5.
Sub Form_Load () 'Declare variables as OLE Objects. Dim OraSession As OraSession Dim OraDatabase As OraDatabase Dim OraDynaset As OraDynaset 'Create the OraSession Object. Set OraSession = CreateObject("OracleInProcServer.XOraSession") 'Create the OraDatabase Object by opening a connection to Oracle. Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&) 'Add EMPNO as an Input parameter and set its initial value. OraDatabase.Parameters.Add "EMPNO", 7369, ORAPARM_INPUT 'Add ENAME as an Output parameter and set its initial value. OraDatabase.Parameters.Add "ENAME", 0, ORAPARM_OUTPUT 'Execute the Stored Procedure Employee.GetEmpName to retrieve ENAME. ' This Stored Procedure is located in the file ORAEXAMP.SQL. OraDatabase.ExecuteSQL ("Begin Employee.GetEmpName (:EMPNO, :ENAME); end;") If OraDatabase.Parameters("EMPNO").Status & ORAPSTAT_INPUT Then MsgBox "Parameter EMPNO used for input." End If If OraDatabase.Parameters("ENAME").Status & ORAPSTAT_OUTPUT Then MsgBox "Parameter ENAME used for output." End If 'Display the employee number and name. MsgBox OraDatabase.Parameters("EMPNO").value MsgBox OraDatabase.Parameters("ENAME").value 'Remove the Parameters. OraDatabase.Parameters.Remove "EMPNO" OraDatabase.Parameters.Remove "ENAME" End Sub