dbTalk Databases Forums  

Re: how insert value null in row

comp.databases comp.databases


Discuss Re: how insert value null in row in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kristian Damm Jensen
 
Posts: n/a

Default Re: how insert value null in row - 11-07-2006 , 07:36 AM






nawfer wrote:
Quote:
if the table mysql has 4 field so:
ID int(11) NOT NULL auto_increment,
camp2 varchar(10) NOT NULL default '',
camp3 int(11) NULL default '',
camp4 varchar(10) NULL default '',
PRIMARY KEY (ID),
KEY camp3 (camp3)
This seems fishy. Why would you want defaults, if you are going to allow
nulls?

Doesn't default mean: "If no value is provided (i.e. null is inserted), use
this."

--
Regards,
Kristian Damm Jensen
"This isn't Jeopardy. Answer below the question."




Reply With Quote
  #2  
Old   
David Cressey
 
Posts: n/a

Default Re: how insert value null in row - 11-07-2006 , 07:46 AM







"nawfer" <novalidsforspam (AT) alt (DOT) al> wrote

Quote:
if the table mysql has 4 field so:
ID int(11) NOT NULL auto_increment,
camp2 varchar(10) NOT NULL default '',
camp3 int(11) NULL default '',
camp4 varchar(10) NULL default '',
PRIMARY KEY (ID),
KEY camp3 (camp3)


why it does not make me to update camp3 and 4 with a value null or ''
do not work:
UPDATE $my_var_tabella
SET camp3 = '', camp4 = ''
WHERE ID = $my_var_number

also writing
SET camp3 = NULL, camp4 = NULL not work
where is the error?

instead if I insert some data it works:
SET camp3 = $id_number, camp4 = $name_text

not want '' or NULL, even if with CREATE TABLE I have insert in
camp3 and 4 this '' how default
I can't say anything about mysql.

In Oracle, according to the documentation, they used the same
representation for the empty character string and the missing value in a
VARCHAR field. Thus isnull('') yields true. That was an error on part of
the builders of Oracle, and results in behavior like the one you have
pointed out.




Reply With Quote
  #3  
Old   
Kristian Damm Jensen
 
Posts: n/a

Default Re: how insert value null in row - 11-07-2006 , 03:50 PM



David Cressey wrote:
<snip>
Quote:
In Oracle, according to the documentation, they used the same
representation for the empty character string and the missing value
in a VARCHAR field. Thus isnull('') yields true. That was an error
on part of the builders of Oracle, and results in behavior like the
one you have pointed out.
Sybase ASE (and I presume MS SQLServer) has the same "feature".

--
Regards,
Kristian Damm Jensen
"This isn't Jeopardy. Answer below the question."




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.