Setting Null to a nullable decimal column

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Setting Null to a nullable decimal column

Post by srinivas.nettalam »

Is that true that if we use SetNull() to a nullable decimal field ,it goes as 0.00 in to database???I really felt wierd when most of the people said that.
N.Srinivas
India.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not test that theory yourself? Sounds all kinds of wrong to me.
-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 »

Sometimes the database columns have default values set. Maybe thats in play here.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to not mention a column in your DML for the default value to be used, setting it to null will cause it to be null regardless of the default. That's true for Oracle and I'm assuming other databases as well.
-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 »

In DB2 it depends how the DBA has set it. There are conditional values on inserts as well.
Test it out as Craig mentioned. Drop the records in a dataset or flat file and see what the values are. If it shows up null there then there is something on the database side.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Post by srinivas.nettalam »

thanks all for your replies..I am getting NULLs in database.I was confident enough but the counters were many.Hence I posted but yes it is my fault to post it before testing on my own
N.Srinivas
India.
Post Reply