Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best/Easiest way to execute a SQL Command

Status
Not open for further replies.

Wholsea

Programmer
Jun 16, 2004
138
US
I have a few steps of a process that reqire me to submit a delete command ( delete from tablename where blah = 'blah') or an update command (update tablename set blah='blah' where blah = 'blah')

What is the best way to do this in datastage, against an Oracle table?

TIA!

ASP, VB, VBS, Cold Fusion, SQL, DTS, T-SQL, PL-SQL, IBM-MQ, Crystal Reports, Crystal Enterprise
 
Don't fault me for my spelling. It stinks...

ASP, VB, VBS, Cold Fusion, SQL, DTS, T-SQL, PL-SQL, IBM-MQ, Crystal Reports, Crystal Enterprise
 
Stage=Input=SQL
Then there is a Before and After tab on each stage. This can be raw SQL or as stored procedure.

-------------------------
The reasonable man adapts himself to the world. The unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. - George Bernard Shaw
 
With Oracle I find it easy to run the DSExecute command from a DataStage routine to execute a SQLPLUS command. You build the command by calling sqlplus followed by the sql to be executed. It can then be called up from Sequence jobs and you can put the command status and command output into the DataStage log. You can also wrap your SQLPLUS command into a shell script that sets various output options.

I never use before SQL, after SQL, before-job or after-job because it doesn't follow good modular code design. I prefer to seperate these things at the sequence job level.

Simpel example that runs a Unix script called mysql:
OracleCmd = "sqlplus username/password@dbname @mysql.txt"
call dsexecute(Unix, OracleCmd, Output, RtnCode)
Call dsloginfo("Sql Result: " : Output, "SQL")
 
I was able to use the Before and After tabs to accomplish what I was trying to do.

Thanks for the help.

ASP, VB, VBS, Cold Fusion, SQL, DTS, T-SQL, PL-SQL, IBM-MQ, Crystal Reports, Crystal Enterprise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top