Custom - 'Insert else Update' or 'Update else insert'

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
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Custom - 'Insert else Update' or 'Update else insert'

Post by raju_chvr »

We have a situation in which we have to 'Insert else Update' or 'Update else Insert'.

It works fine at is is for us. In our project the SKEY are the target tables are generated using Oracle Sequencers which have to called in the Insert statements as they are not - called by Triggers.

So, can we make the SQL to be 'Custom SQL' and have both Update and Insert statements one after the other and expect the same Functionality as Upsert or is it that DataStage or Oracle will treat them as separate 2 SQL statements and will execute both of them.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Which one occurs first depends on which option you choose. Obviously you only invoke the sequence in a custom INSERT statement - for an UPDATE statement you must already know the key value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Post by raju_chvr »

Actually my question is - if we use CUSTOM SQL with both Insert and Update statements one after the other, will DataStage and Oracle still treat it as Upsert Statement or not ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'm actually not sure, never tried it as I tend to avoid those 'combo' actions. Why not give it a shot and let us know?
-craig

"You can never have too many knives" -- Logan Nine Fingers
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Post by raju_chvr »

Tried and Tested it. It actually executes both Insert and Update statements one after the other and doesn't do them conditionally ?

Can I use Merge Statement in ORAOCI stage ?

PS: We are on Linux Platform with DataStage 8.1 Server edition connecting to Oracle 10g using OraOci 9i stage..
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

You should be able to use Merge statement
You are the creator of your destiny - Swami Vivekananda
Post Reply