Multiple SQL in "Load SQL from file at run time"

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Maximus_Jack
Premium Member
Premium Member
Posts: 139
Joined: Fri Apr 11, 2008 1:02 pm

Multiple SQL in "Load SQL from file at run time"

Post by Maximus_Jack »

Hi
I did some googling and searched this forum as well, but couldn't find it.

I'm trying to execute multiple sql's in oracle stage using the "Load SQL from file at run time"
option, seperating each sql with a ";" , but datastage is taking all the sql as a
single SQL and trying to run and its getting aborted, is there
any way i can use multiple sql in the "Load SQL from file at run time" option.


cheers
MJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't recall if that is an option when using a SQL file (always used it for a single statement) and I don't have any way to check right now. Only thing I can think of right now is to try two semi-colons as a separator: ";;".
-craig

"You can never have too many knives" -- Logan Nine Fingers
Maximus_Jack
Premium Member
Premium Member
Posts: 139
Joined: Fri Apr 11, 2008 1:02 pm

Post by Maximus_Jack »

hi craig, thanks for responding, tried that too.. its not working..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then it's not supported it would seem. Why not just add a UNION ALL between them so they become a single Sql statement?
-craig

"You can never have too many knives" -- Logan Nine Fingers
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

Jack,
If you use multiple queries then it will throw an error for invalid character ";".
What sort of sqls you are using, why dont you use Before/After SQL or try union as suggested by Craig.
I had the same problem so I used Before SQL.
Thanx and Regards,
ETL User
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

These must be source SQLs, as in ones that provide data to the job so I'm assuming they are not appropriate for using before/after. If you don't want to go the 'union' route then perhaps the job can be 'looped' via a Sequence job that replaces the sql file each iteration.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Maximus_Jack
Premium Member
Premium Member
Posts: 139
Joined: Fri Apr 11, 2008 1:02 pm

Post by Maximus_Jack »

Hi thanks for responding..
the queries are dynamically generated... and i want to use those data in the job.

I think by somehow i have to generate the columns of the sql queris as a single concatenated columns and separate them with commas andand as craig said i should then union them all, before passing it to the sequential files
sudha03_vpr
Participant
Posts: 34
Joined: Tue Feb 26, 2013 9:36 am
Location: Chicago

Post by sudha03_vpr »

Craig's idea looks to be simplest. You can also read the sql into the parameter and loop it so each sql reads the data and loads it to the file. This approach may be good if you wanted the sqls to be loaded to the seperate file instead of same file.
Post Reply