I have a sql statement that pulls data from an Oracle database. In the past I have used variations of this statement to populate an Access table. Now, I would like to retrieve the data from Oracle and pass it back directly to MacroScript, but the SQL statement returns multiple rows of data.
Can't quite get my mind around how to send three or more records from some SQL within VBScript back to MacroScheduler.
I know I could continue to write the data to an Access table, then read that table row at a time to get the data in the form I want, but that seems like an un-needed step.
SkunkWorks.
Data from Oracle
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Create a VBScript function which opens the datasource and assigns the recordset result of the SQL statement to a global VBScript variable (Dim the variable before the functions). Then have another VBScript function which retrieves the next row (or a specified row - i.e. it takes a row number as a parm). Have this function return the fields of the row as a semicolon delimited string (or set a global VBScript array). This structure will then allow you to loop the data in MacroScript. Call the VBScript function that retrieves the next row in a MacroScript loop and explode the fields with Separate (or access a VBScript array).
MJT Net Support
[email protected]
[email protected]