executing a bunch of SQL Statements

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
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

executing a bunch of SQL Statements

Post by mystuff »

I need to execute a bunch of SQL Statements.
(There are some truncate statements and some delete statments)
target is Oracle db.
what is the best way to execute the bunch of sql statements?


what i tried is:

DummySeq_File-->X-->DRS_Stage

one column i mentioned as a dummy value
and update action:User defined SQL

and used bunch of sql statements.

but its throwing exception:column name invalid identifier.



thanks

Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

mystuff - could you post the SQL that is causing the error message you listed?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's no way you can execute "a bunch" of different sql statements from a single link, you won't be able to bind everything properly to the columns in the stage. Which is exactly what your error says happened.

For something like that, I'd suggest a script via sqlplus. Or put them in a proc.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

chulett wrote:There's no way you can execute "a bunch" of different sql statements from a single link, you won't be able to bind everything properly to the columns in the stage. Which is exactly what your error say ...

As Chulett says you cannot execute multiple sql statements in user-defined sql. User-defined sql to write only a single query big or small.

Regards
Sreeni
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

MyStuff,

Why don't you try a shall script for your requirement. That should help you run as many SQL as possible, as long as you have resources to attend the task.


Regards,
Sm
Regards,
Shree
785-816-0728
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

If your SQL statements really have nothing to do with the row you are passing to the DRS stage, then do not pass any rows. Set the output constraint to @FALSE, and put you SQL statements on the after SQL tab.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

my intention is just to execute a bunch of sql statements.
i dont need to perform anything within the job, other than execution of sql statements.

what is the most optimistic desgin of the job?
i mean which is best to use,(eg:odbc or oci or oracle plugin)

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

Post by chulett »

No stages. Scripts.

DSExecute a sqlplus script with your 'bunch' in it from the Job Control tab. Or run them one at a time so that each can log their individual runtimes plus success or failure into the job's log. You can even wrapper them with DSLogInfo calls to be more verbose...

Running script 1...
Script 1 execute successfully.
Running script 2...

Etc.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply