odbc insert

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kishoreramachandran
Participant
Posts: 88
Joined: Tue Nov 28, 2006 9:33 pm

odbc insert

Post by kishoreramachandran »

I have got an odbc table as input and I am doing an insert on this table through a sql and this sql is joining many tables then is it required to refer to those table columns somewhere in the input or just the sql will take care of it. basically say input is table emp and I am inserting values to this table so output is also same table emp.the sql is referring to many other tables.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? I'm sorry, but you'll need to restate your question as it's not really obvious what you need help with. I can pull this piece out which seems to be the heart of the matter:
kishoreramachandran wrote:is it required to refer to those table columns somewhere in the input or just the sql will take care of it
However, still not really clear what your issue is or how 'sql is referring to many other tables' is relevant. :cry:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kishoreramachandran
Participant
Posts: 88
Joined: Tue Nov 28, 2006 9:33 pm

Post by kishoreramachandran »

I have a odbc table and a sql that is going to insert records into that table .The sql is referrring to many other tables to populate this table and I need to check if some of them are null and replace with a different value. then should I have all those tables as input to my transformer.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You can do that in the sql itself. I think using the Collasce function. NOt sure, google for it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Within a Transformer stage, use a NULL-handling expression in each case - maybe create a NullToValue Transform.

But, as Craig suggested, you can do this within the extraction SQL. Depending on the database the function may be called something like NVL(). COALESCE() selects the earliest non-null value from a list of values/column references (or returns null if they are all null).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That was Bill, or Chuck or whatever 'nom de plume' DSGuru2B is operating under today. :wink:

As noted, you can do this in your SQL or in your job - your choice. Typical SQL solutions could include NVL or DECODE or COALESCE, for specific answers we would need to know your database.

In the job, IsNull could help or a NullToValue transform could be created, modeled after the existing NullToEmpty / NullToZero transforms.

It really depends on where these 'different values' come from.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

chulett wrote:That was Bill, or Chuck or whatever 'nom de plume' DSGuru2B is operating under today. :wink:
Still a Mystery :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Your sql query can refer or join any numnber of tables.
You don't need to have each of the tables you are refering to as an input to the transformer.
You coudld also use Oracle NVL function, which lets you substitute a value when a null value is encountered.
Check Google for the syntax for the Oracle NVL function.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

narasimha wrote:You coudld also use Oracle NVL function...
Really? Where did anybody (other than you, that is) mention the 'O' word? :P
-craig

"You can never have too many knives" -- Logan Nine Fingers
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

chulett wrote:
narasimha wrote:You coudld also use Oracle NVL function...
Really? Where did anybody (other than you, that is) mention the 'O' word? :P
O..ooo I should read the posts more in details. I am so obsessed with Oracle :)
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
Post Reply