character field null issue

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
abhik05
Participant
Posts: 28
Joined: Thu Mar 08, 2012 8:31 am

character field null issue

Post by abhik05 »

I have one source field 'A' defined as nullable varchar(5).The target database field is defined as nullable char(2). Whenever null values are coming in source field some unknown character is getting inserted in target field.Target database is DB2.
Running ascii(A) function against the field(A) in the database,I am getting value 0,which is null.But when giving clause against the field as 'is null',this specific record is not being selected.

I have given conditions like "if isnull(a) then setnull() else trim(a)" in transformer.But still facing the same.

Any suggestion plz.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Identify the "unknown character". Perhaps convert it to hex.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abhik05
Participant
Posts: 28
Joined: Thu Mar 08, 2012 8:31 am

Post by abhik05 »

database is DB2:

hex(field) is giving value 0000.
ascii(field) is giving value 0

Plz suggest.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The value is represented by Char(0) or UniChar(0). You can use either of these representations in functions such as Convert(). In particular, this value is not the same as NULL (even though it's referred to in ASCII as "NUL").
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply