Data from Oracle

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Data from Oracle

Post by pgriffin » Mon Nov 21, 2005 5:36 am

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.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Nov 21, 2005 6:39 am

Can you provide some samples of the rows of data that are returned? Maybe five or more records?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Nov 21, 2005 7:44 am

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]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts