Update a column using OCI stage

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
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Update a column using OCI stage

Post by I_Server_Whale »

Hi All,

I'm trying to update a column of a table by running the following query:

Code: Select all


UPDATE LSTG_REJECT_REC
SET TARGET_TABL_NM = decode(TARGET_TABL_NM,'LDW_CERT_%','LDW_CERT','LDW_CERT_END_%','LDW_CERT_END',TARGET_TABL_NM)

My job design to execute this query is as:

Code: Select all




  Transformer(Dummy)------------------------------------>OCI stage


The OCI stage executes the 'user-defined SQL' as shown above. Is this an efficient way of updating the column of a table?

Your thoughts and guidance are very much appreciated,

Thanks,
Naveen.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Efficient for speed? How are you going to control commit rate or rollback usage? Your design means that only 1 row of data is required for processing in order to fire this query. Which rows are affected? How many rows were actually updated? Why is it taking so long? How will you measure this job?

If none of those questions matter, your design is, IMO, a little hokey. Why build job parts to run a simple SQL script, when a shell script call to sqlplus could run this as a script? Sure would be easier to manage. But if you're told to "do this using DataStage", aren't you cheating? Is DataStage just a surrogate SQL runner or an ETL tool.

Consider first querying the rows that meet your criteria and writing out the primary keys and the replacement value to a file. Then, run that file into a transformer and then to the OCI stage using update existing rows only SQL. Now you get metadata, restartability, commit rate control, performance measurement, audit trails, etc.

But that's just my opinion.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: Update a column using OCI stage

Post by ogmios »

The original solution works for as long as you don't exhaust transaction log space (because it's a single transaction), this depends on the database settings and width of a single row. Usually this works for upto +- 400.000 rows, not for millions.

Solution is to have actual input on the left hand side of your job, this will allow you to use transactions in a proper way.

Ogmios
In theory there's no difference between theory and practice. In practice there is.
Post Reply