ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Executing a Script on an Oracle DB (https://www.excelbanter.com/excel-programming/280822-executing-script-oracle-db.html)

EWill

Executing a Script on an Oracle DB
 
I have a rather lengthy script I need to execute from within Excel,
however the scipt will not fit into a string (the script is about 2.5
pages long). How can I pass a long SQL stmt to oracle.

Note: The script will not return any results its an select/insert
stmt, based on criteria from the excel spreadsheet.

Tom Ogilvy

Executing a Script on an Oracle DB
 
Put it into an array of 127 character elements:

so if you had a named argument querytext
queryText:=MakeSQLArray(QueryString)


'Function MakeSQLArray converts a string into an array of strings,
'each element being a string that is 127 characters or less.
Function MakeSQLArray(ByVal String1 As String)
Dim ArraySize As Integer
Dim SQLArray() As String
Dim x As Integer
ArraySize = 1 + Int((Len(String1) - 1) / 127)
If ArraySize < 1 Then
ArraySize = 1
End If
ReDim SQLArray(ArraySize) As String
For x = 1 To ArraySize
SQLArray(x) = Left(String1, 127)
If Len(String1) 127 Then
String1 = Right(String1, Len(String1) - 127)
End If
Next
MakeSQLArray = SQLArray
End Function


--
Regards,
Tom Ogilvy


"EWill" wrote in message
om...
I have a rather lengthy script I need to execute from within Excel,
however the scipt will not fit into a string (the script is about 2.5
pages long). How can I pass a long SQL stmt to oracle.

Note: The script will not return any results its an select/insert
stmt, based on criteria from the excel spreadsheet.





All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com