help....sql loader and VB [message #53101] |
Wed, 28 August 2002 05:41 |
Venkat
Messages: 110 Registered: February 2001
|
Senior Member |
|
|
Please let me know the code to use sql loader in VB to load a text file to oracle database table
|
|
|
Re: help....sql loader and VB [message #53124 is a reply to message #53101] |
Wed, 28 August 2002 11:37 |
Trifon Anguelov
Messages: 514 Registered: June 2002
|
Senior Member |
|
|
First create batch file for the SQL*Loader c:load.bat
sqlldr user/pass@db_alias control=control.ctl log=log.log bad=bad.bad ....
Then run the batch file from VB:
Private Sub cmdTransferData_Click()
On Error GoTo ErrHandler
Dim newHour As Date
Dim newMinute As Date
Dim newSecond As Date
Dim bCont As Boolean
Dim waitTime As Date
Dim vTaskID As Variant
Dim bCont as boolean
vTaskID = Shell(“c:load.bat") ‘Shell out to run the batch file from above
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 3
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime ‘Wait for the load to complete
ReCheckWait:
While Not bCont ‘Continue polling SQL*Loader and when it no
‘longer responds Goto ErrHandler below
AppActivate "sqlldr.exe", False
Wend
Beep
Beep
Beep
Finish:
Exit Sub
ErrHandler:
If Err.Number = 5 Then ‘AppActivate failed, change status of bCont ‘to True and Resume.
bCont = True
GoTo ReCheckWait
End If
err_handler "cmdTransferData_Click", Err.Number, Err.Description
End Sub
Hope that helps,
clio_usa
OCP - DBA
Visit our Web site
|
|
|