List:General Discussion« Previous MessageNext Message »
From:<lakshmi.narasimharao Date:March 30 2005 3:47am
Subject:Regarding NULL and '' (null string) treatment in MYSQL
View as plain text  

    MySQL treats NULL, '' (empty string) as different.

    I mean when I select from/insert into a table, its behaviour is

   Select * from table1 where name=''; 

   is different from

   Select * from table1 where name=NULL;  


   Insert into table1(name) values('')  is different from

   Insert into table1(name) values(NULL) 

   Please suggest me here, how to overcome this '' (null string)


 I have two tables, one is parent and one is child.

 Child is referencing 3 fields in parent table.

Parent table records are empty. Now I am trying to insert into the child
table with  '' (null string) values into these 3 fields (which are
referencing to the parent table).  Actually insert into the child table
in this scenario should be successful, but I am not able to make it
success because of the problem described above ( Treatment of NULL, ''
are different).

Note: If the parent is not having any records, we can insert into the
child. BCS, in this case referential integrity won't work.
Ps: In oracle, it is not the case it treats NULL,'' as same.

Please suggest me how to proceed here.


Confidentiality Notice

The information contained in this electronic message and any attachments to this message
are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged
information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@stripped immediately
and destroy all copies of this message and any attachments.
Regarding NULL and '' (null string) treatment in MYSQLlakshmi.narasimharao30 Mar
  • Re: Regarding NULL and '' (null string) treatment in MYSQLPeter Brawley30 Mar
    • Re: Regarding NULL and '' (null string) treatment in MYSQLShankar Unni30 Mar