Page 1 of 1

Need to update null to zero

Posted: Wed May 26, 2010 12:13 am
by gssr
HI,
My requirement is to update a COLUMN in oracle table from the value from netezza table. The job is running fine and updates the value with respective id.
If an id is not in my netezza table , the column was left as null value.

Now i need to update values if the id is present in source else need to set as zero..

Thanks in advance :!:

Posted: Wed May 26, 2010 12:35 am
by truenorth
I'm not clear on the mapping, but consider using Oracle left outer join to netezza and NullToZero(value from netezza).

Posted: Wed May 26, 2010 1:09 am
by gssr
truenorth wrote:I'm not clear on the mapping, but consider using Oracle left outer join to netezza and NullToZero(value from netezza).
lets consider Table Tab_A,
ID COL_A
1 199
2 299
3 399

Table Tab_B
ID COL_B
1 NULL
2 NULL
3 NULL
4 NULL
...

Need to update the table Tab_B from Tab_A,
Tab_B should be,
ID COL_B
1 199
2 299
3 399
4 000

Need to Update "0" to COL_B for the ID that is not present in the TAb_A...

Posted: Wed May 26, 2010 1:44 am
by truenorth
Just as I thought.

Tab_B left outer join Tab_A on ID

followed by

Transformer, where Tab_B.COL_B is derived from NullToZero(Tab_A.COL_A)

Where the ID matches, Tab_B.COL_B gets the value from Tab_A. Otherwise, it gets zero.

Posted: Wed May 26, 2010 4:05 am
by ray.wurlod
If you're updating while data are in transit, use NullToZero() function.

If you need to update in the Oracle table, don't bother using DataStage - execute a simple UPDATE statement against the table.

Posted: Wed May 26, 2010 6:38 am
by chulett
How is this any kind of WORKAROUND? You are (or certainly should be) Resolved now. :?

Posted: Thu May 27, 2010 12:20 am
by gssr
I deployed two jobs,
One to update the Oracle table from Netezza Table
second to update null value to zero in Oracle table

I am working around with some more option..... to do it in one job
8)

Posted: Thu May 27, 2010 7:10 am
by chulett
OK, your "two jobs" is a workaround of sorts but there is absolutely no need for two jobs to do something so simple.