Hi All,
I am getting a problem regarding NULL..
I am taking ''(empty string) in one of the columns from my source, I am passing the columns from 4 transformers(for lookups) and at last I am writing them to target table.., The corresponding column in the target is not NULLable, But when I run the Job it throws an error saying "can't write NULL for not Nullable column" for that column.
If I hardcode the value ''(empty string) in the last tarnsformer for the column, it accepts the row.
Even if I have checked the column value through isNull function in the stage variables of the last transformer, it shows it as a NOT NULL there also, What is the cause of the Problem..?
Thanks in advance...
Getting Null When Trying to Populate ''(empty string)
Moderators: chulett, rschirm, roy
Re: Getting Null When Trying to Populate ''(empty string)
Dear WoMaWil
Null means unknown.
Empty string is not unknown.
u can verify the difference by inserting '' in a not null column of a table, it wud accept that, but with null it wud throw an error.
Try this in SQL
create table abc
(
a char primary key not null
)
select * from abc
insert into abc values('')
insert into abc values(null)
U will notice the difference.
Null means unknown.
Empty string is not unknown.
u can verify the difference by inserting '' in a not null column of a table, it wud accept that, but with null it wud throw an error.
Try this in SQL
create table abc
(
a char primary key not null
)
select * from abc
insert into abc values('')
insert into abc values(null)
U will notice the difference.
Even I have noticed that starnge behaviour in past, not sure what the reason is. But from what I was able to conclude is that, it happens when you move that data between trasformers somehow that empty string is treated as null.
Try running nulltoempty routine, in the last xformer....and you will see it work fine without any error.
HTH
Try running nulltoempty routine, in the last xformer....and you will see it work fine without any error.
HTH
Re: Getting Null When Trying to Populate ''(empty string)
Just for the record, try this in Oracle and both will fail - which is why I asked about the target database... and probably why WoMaWil made his assertation. Any discussion of database related issues should include a mention of the database in question because of differences like this.loveojha2 wrote:Try this in SQL
create table abc
(
a char primary key not null
)
select * from abc
insert into abc values('')
insert into abc values(null)
U will notice the difference.
Your issue is, as mentioned, the handling of an empty string as it is passed from transformer to transformer.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: