Option Explicit
Dim OraSession As OraSession
Dim OraDatabase As OraDatabase
Dim OraDynaset As OraDynaset
Dim OraFields As OraFields
Sub test0040()
' Create the OraSession Object. The argument to CreateObject is the
' name by which the OraSession object is known to the OLE system.
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
' Create the OraDatabase Object by opening a connection to Oracle.
Set OraDatabase = OraSession.OpenDatabase("вашабаза", логин/пароль", 0&)
'--запускпроцедуры
OraDatabase.ExecuteSQL ("begin " + usr + cnn7(77) + ";end;")
' Create the OraDynaset Object.
Set OraDynaset = OraDatabase.CreateDynaset(cnn7(78), 0&)
' You can now display or manipulate the data in the dynaset. For example:
Set OraFields = OraDynaset.fields
OraDynaset.MoveFirst
Do While Not OraDynaset.EOF
Debug.Print OraFields("role").value
OraDynaset.MoveNext
Loop
OraDatabase.Close
End Sub
Sub cancelling()
Dim OraDatabase As OraDatabase
Dim OraStmt As OraSqlStmt
Dim stat As Long
Dim OraSess As OraSession
Set OraSess = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSess.OpenDatabase("вашабаза", логин/пароль", 0)
'execute the select statement with NONBLOCKING mode on
Set OraStmt = OraDatabase.CreateSql("select count(*) from схема.большаятаблица", ORASQL_NONBLK)
'Check if the call has completed
stat = OraStmt.NonBlockingState
If stat = ORASQL_STILL_EXECUTING Then
MsgBox "Cancelling the asynchronous operation that is underway"
OraStmt.Cancel
End If
End Sub
|