Recognizing "null bytes" in a varchar field

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Recognizing "null bytes" in a varchar field

Post by chulett »

Had an interesting issue this morning and looking for some advice. Client supplied flat file has quote-unquote "junk" in several fields that really should be empty. And since they're not empty, they pass the "null or empty" sniff test that would normally get them excluded from the Oracle load which promptly goes all ker-blooey when it declares them as nulls that have no business being in a field that doesn't allow them.

Specifically, the "junk" looks to me like "low values" from my old COBOL days and are what one DBA on the thread described as "a series of 8 bits of which no bits are set". For those familiar with the Oracle function 'DUMP' it dumps as:

Type=1 Len=5: 0,0,0,0,0

What's the best way to detect a value like this? Convert all of the CHAR(0) values to '' and then check for empty?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Compare to Str(Char(0),5) ?
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 »

My way didn't work out but yours did. Thanks. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply