Converting a nullable source to a non-nullable result

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

Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Converting a nullable source to a non-nullable result

Post by Hope »

I have 5 columns in a table. I am taking only one column from the table and writing it to a Seq file.This is Parallel job.
and the column is not nullable.The column is set is not nullable in the Target i.e the sequential file.it is a simple load from a
table to a file.I am getting the following warning.
"Converting a nullable source to a non-nullable result".

Please suggest how I can get rid of this warning
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please post the exact, complete error message and the record schema associated with the link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post by Hope »

SQL_Process_Run_Control: When checking operator: When binding output interface field "Col1" to field "Col1": Converting a nullable source to a non-nullable result;
a fatal runtime error could occur; use the modify operator to
specify a value to which the null should be converted.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

And the record schema?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: please move to parallel forum
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shamshad
Premium Member
Premium Member
Posts: 147
Joined: Wed Aug 25, 2004 1:39 pm
Location: Detroit,MI

Post by shamshad »

You mean the column in the target is NOT NULLABLE and the source column may be NULL? In this case why not check if the coming column has nulls and if yes initialize the value with not nulls, empty values, spaces....Check "Null Handling Functions" in Parallel Jobs like NulltoZero(), NulltoEmpty() etc.

The idea is NOT to send NULL VALUES to target columns.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, I mean the record schema. You can find this in the table definition (parallel view) or in the generated OSH.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post by Hope »

record
{final_delim=end, record_delim='\n', delim=',', quote=double}
(
Col1:int16 {quote=none};
Col2:string[max=20] {prefix=2};
Col3:string[max=15] {prefix=2};
)

This is the record schema of the source which is SQL table.I am taking only Col1 to target and writing it to a sequential file.I defined the Col1 as not nullable in target.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

Hope,

Did you have any intermediate stage that is in between Source and Target Stages as to have a removal of other columns or only in the Source Stage?
Last edited by ag_ram on Sat May 31, 2008 3:00 pm, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You say you have five columns, you show me a record schema with three columns, and that you are discarding two of those. Why not select just the one column that you need? To get rid of the error, just do as it says - add some null handling.

I suspect there is more to your job design than you are telling us. For example, a "full and complete" error message would include the name of the stage/operator that generated it, allowing us to narrow our diagnostic focus.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post by Hope »

I am sorry I forgot to mention that when extracting data from table I am writing a User-defined query.select max(col1) from table. I played around by taking out max(col1) and just extract select col1 from table. I dont get that warning.but if I give select max(col1) from table then I get the warning.

Any suggestions to get rid of this warning plz?.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SQL Functions are always assumed to be able to deliver null (and therefore to be nullable). Short of using an intermediate temporary table I don't believe there is any solution. You could use a message handler to demote the message to informational.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Hope
Participant
Posts: 97
Joined: Sun May 13, 2007 2:51 pm
Contact:

Post by Hope »

Thanks for the information ................Ray.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You haven't mentioned your database, but what about doing something like this, which is Oracle syntax:

Code: Select all

select NVL(MAX(col1),0) from table
A null result would be substituted with a zero (or whatever would be more appropriate) and then you could make the source column non-nullable. Yes no maybe so? :?
-craig

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

Post by ray.wurlod »

Don't believe so. I understand that metadata capture unconditionally assumes that any function (including NVL) may return a nullable result.
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