1748094 Members
5964 Online
108758 Solutions
New Discussion

Re: null or void?

 
SOLVED
Go to solution
BGiulio
Occasional Contributor

null or void?

Hello Dudes,

I have a doubt and I wonder if some of you may shed any light on this matter:
This is the situation:

insert into PIPPO (CLMN1,CLMN2,CLMN3)
values ('A',,'B');

and

insert into PIPPO (CLMN1,CLMN2,CLMN3)
values ('A','','B');

are producing the same result, in particular if the CLMN2 is defaulted with 'PLUTO', what would be present in that field after the UPDATE statement committed?

Thanls a lot!

Giulio



1 REPLY 1
Bill Thorsteinson
Honored Contributor
Solution

Re: null or void?

In the first case CLMN2 will be NULL, assuming that',,'
is treated as an implict null value.

In the second case CLMN2 should contain an empty string.
Some interfaces may treat this as NULL, and you may get
a NULL value in the database.

In both cases you have set the value so the default does
not come into play. The following should use the default.

insert into PIPPO (CLMN1,CLMN3)
values ('A','B');

If you want to use the default when the value is set to
NULL or an empty string, you should use a trigger.