Null value handling

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
abby
Participant
Posts: 13
Joined: Fri Dec 30, 2005 1:00 am

Null value handling

Post by abby »

Hi,

I have been struggling to insert a Null value into one of the mandatory column(which allows Char data only) when no value is passed to it.

The problem area is :

I am trying to load data from a sequential file to the Sybase database. The last column in the row is mandatory but if no value is passed to it then a Null value must be stored in the database.

But if the file data contains Null as the column data then the '?' mark in the Insert statement is internally replaced with 'Null' i.e. a hardcoded string(enclosed in single quotes) which creates error.

I simply want to send the value as Null (without enclosing in single quote) which is acceptable in Sybase.

I have also tried replacing the '?' mark with Null as required but it didn't worked anyway.

How can I send the Sybase acceptable Null (without enclosed in single quotes) from my insert job?

Many Thanks in advance...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You are replacing null values in the file with the word "null"? You should be replacing it with the system variable @NULL instead, if I'm understanding your problem. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Placing a @NULL as the derivation of a column in a transformer stage should work, if the column is nullable by DB definition.
When you say a mandatory coulmn I assume the column is defined as not null in the DB which won't allow this kind of data, or rather lack of data in the column.
So if your column is defined as not null you must have a value inserted, hence you can choose to put the string 'NULL' if this is your need.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
abby
Participant
Posts: 13
Joined: Fri Dec 30, 2005 1:00 am

Post by abby »

Thanks for the prompt help !!!!

It really worked....and the problem seems to be rectified now.
abby
Participant
Posts: 13
Joined: Fri Dec 30, 2005 1:00 am

Post by abby »

roy wrote:Hi,
Placing a @NULL as the derivation of a column in a transformer stage should work, if the column is nullable by DB definition.
When you say a mandatory coulmn I assume the column is defined as not null in the DB which won't allow this kind of data, or rather lack of data in the column.
So if your column is defined as not null you must have a value inserted, hence you can choose to put the string 'NULL' if this is your need.

IHTH,
Roy,

Thanks very much for timely help.

The mandatory column here does allow a Null value as per the table definition.

Well, using @NULL has resolved the issue at the moment but I need to look into this more later on.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

abby wrote:The mandatory column here does allow a Null value as per the table definition.
Then it's not mandatory. :wink:
-craig

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