Null Values

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Null Values

Post by ketfos »

Hi,
I need to handle a null column value.

Input is sequential file file.
One of the input column has null value.
Output is ORacle table and all columns are NOT Null.
In the transformer, i write
If IsNull(InRec.CITY_ADR) Then " " Else InRec.CITY_ADR

When I run the job and look in Director log, it has warning message
Customer..TransCust: ORA-01400: cannot insert NULL into ("Cust_t"."CITY_ADR")

Is there any other check I need to perform to avoid this error?

Thanks
Ketfos
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Is the field of varchar datatype?
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

No, it is Char(45). and Not Null


Thanks
Ketfos
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can you try writing it into a seq file to check the value.
lebos
Participant
Posts: 74
Joined: Mon Jan 20, 2003 10:02 am
Location: USA

Post by lebos »

You said your input is a sequential file and that it has a column with a null value. How did you accomplish that? I don't see how a sequential file can have a null value. An empty string perhap, but not a null value.

Perhaps you should say:

If InRec.CITY_ADR = "" Then " " else InRec.CITY_ADR

Try it and see.

Larry
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
I wrote to seq file.
The column is empty.

Ketfos
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Try writing some character and not space, see if this works.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,


1. I changed the transformer condition to

If InRec.CITY_ADR = "" Then " " else InRec.CITY_ADR

It still gave the same error message - Cannot insert null value.


2. I was able to write a char into output file as requested by amsh76.

Let me know if get some other ideas or thought.
Thks

Ketfos
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

If I am not wrong, in Oracle, it does equivalent of trim on the column and thats the reason you are getting this problem.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,

Amsh76 - What do I need to do to overcome this error?

Ketfos
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

What I can suggest is use, a different character and not blank for replacing null.
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

amsh76 wrote:If I am not wrong, in Oracle, it does equivalent of trim on the column and thats the reason you are getting this problem.
Sorry but you are wrong, Oracle stores spaces as spaces only. if column is varchar and its not null, it will accept spaces as its values.
Shantanu Choudhary
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Then why this error? :shock:
Post Reply