Deleting from source

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
alhowarth
Participant
Posts: 2
Joined: Thu Oct 12, 2006 9:21 am
Location: Urbandale, IA

Deleting from source

Post by alhowarth »

Hello. I am new to DataStage, so hopefully I ask the question correctly.

I would like to create a job that when selecting a row from the source (DB2 UDB), will perform a row-level lock. After copying the data to the destination, deletes the source row.

Thanks,
Al
Al Howarth
System Specialist/Slacker
Berkley Technology Services
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

what is ur destination if u are using same table as source u can just replace the existing row with the new one .
hi sam here
alhowarth
Participant
Posts: 2
Joined: Thu Oct 12, 2006 9:21 am
Location: Urbandale, IA

Post by alhowarth »

The destination is another DB2 database.

Thanks though
Al Howarth
System Specialist/Slacker
Berkley Technology Services
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

I am not sure if you can delete the source rows.

You can try the following.

select user-defined SQL in the stage you use to read the data. In the sql, write the one for deleting. I am not sure if the stage can accept two sqls.

If the above doesnt work. try diong this in another job.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi,
The source and destination are db2 that fine but are they same table.

If not:
1. You can do it in one job by using one Db2 stage, but need to check with the execution order. Else better to design a second job.

If yes:
You can use user defined query option one to load in generated tab and in after tab use the delete statement.
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

I am not sure if you can do this in the same job , can not think of a way to dothis in the same job. Another approach to do this is to pull all the data in a flat file and then delete statement in one job and then useing the file as the source.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,

If there are few numbers of rows you are selecting then you can delete rows from source while inserting into target... becsuse will lock be for select and in one shot you will get all required row and lock will be released after...so you can delete data from source while inserting into target
but If there there is more number of rows then better populate key column from source into flat file while inserting into target and link that file to source and write user defined query to delete.

Source------->Transformer--------->Target
|
|
----------------->Flatfile ------->Source


__________

Anupam[/img]
Last edited by sb_akarmarkar on Thu Oct 19, 2006 3:50 am, edited 1 time in total.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

But you can try to have a ORDER BY class or a Aggregator in the job to check if the lock be released, so that you can delete in the same job.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply