dbTalk Databases Forums  

ExecuteSql Problem (VB6/Oracle 9i )

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss ExecuteSql Problem (VB6/Oracle 9i ) in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JP
 
Posts: n/a

Default ExecuteSql Problem (VB6/Oracle 9i ) - 07-17-2003 , 09:11 AM






I wrote a small VB application that will read in an Oracle package from a
text file and apply it to the database using the ExecuteSql function.
The package is created on the database successfully but with the
following error: "Encountered the symbol "" when expecting one of the
following; begin end function pragma ....." The funny thing about
this is that if I choose to edit the package, using Enterprise
Manager, and then make a minor change to it just so it's modified (add
a space anywhere in the text) it then compiles successfully without
any errors. The process is done in two steps where the package
definition is done first followed by the package body; in both cases
I'm receiving the same error. I've also tried using CreateSql but I
still receive the same error.

The following is the function I wrote:


Function ExecuteScripts() As Boolean

Dim sFileName As String
Dim sScript As String
Dim nCount As Integer

On Error GoTo Error_Handler

' Loop through the array of script names and execute them
Do
' Get the filename of the script from the array
sFileName = sFileArray(nCount)

If sFileName <> "" Then
' Create the directory\filename string
sFileName = GetFileDir() & sFileName

' Read in the script content
sScript = ReadFile(sFileName)

'Execute the script
OraDatabase.ExecuteSQL (sScript)

Else
Exit Do
End If

' Increment the array counter
nCount = nCount + 1

Loop



Error_Handler:
If Err Then
ExecuteScripts = False
Err.Raise Err.Number, , Err.Description
Else
ExecuteScripts = True
End If

End Function

Any help or advice would be appreciated.

Thanks,
JP



Reply With Quote
  #2  
Old   
JP
 
Posts: n/a

Default Re: ExecuteSql Problem (VB6/Oracle 9i ) - 07-17-2003 , 01:58 PM






I figured out my issue. I needed to replace the carriage returns wit a
linefeed before executing the script.

JP



"JP" <jplante (AT) excite (DOT) com> wrote

Quote:
I wrote a small VB application that will read in an Oracle package from a
text file and apply it to the database using the ExecuteSql function.
The package is created on the database successfully but with the
following error: "Encountered the symbol "" when expecting one of the
following; begin end function pragma ....." The funny thing about
this is that if I choose to edit the package, using Enterprise
Manager, and then make a minor change to it just so it's modified (add
a space anywhere in the text) it then compiles successfully without
any errors. The process is done in two steps where the package
definition is done first followed by the package body; in both cases
I'm receiving the same error. I've also tried using CreateSql but I
still receive the same error.

The following is the function I wrote:


Function ExecuteScripts() As Boolean

Dim sFileName As String
Dim sScript As String
Dim nCount As Integer

On Error GoTo Error_Handler

' Loop through the array of script names and execute them
Do
' Get the filename of the script from the array
sFileName = sFileArray(nCount)

If sFileName <> "" Then
' Create the directory\filename string
sFileName = GetFileDir() & sFileName

' Read in the script content
sScript = ReadFile(sFileName)

'Execute the script
OraDatabase.ExecuteSQL (sScript)

Else
Exit Do
End If

' Increment the array counter
nCount = nCount + 1

Loop



Error_Handler:
If Err Then
ExecuteScripts = False
Err.Raise Err.Number, , Err.Description
Else
ExecuteScripts = True
End If

End Function

Any help or advice would be appreciated.

Thanks,
JP





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.