db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: select null - 2nd edition :)
Date Thu, 27 Oct 2005 17:04:47 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I am not sure what SQL standard says about NULLs in this context, but
if you can CAST your untyped null to the type you are inserting to, it
works with Derby.<br>
<br>
Satheesh<br>
<br>
ij&gt; create table tnull (i int, j int, k int);<br>
0 rows inserted/updated/deleted<br>
ij&gt; insert into tnull values (1,2,3);<br>
1 row inserted/updated/deleted<br>
ij&gt; insert into tnull select i, j, null from
tnull;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;===== Raises error, like
you said<br>
ERROR 42X01: Syntax error: Encountered "null" at line 1, column 32.<br>
ij&gt; insert into tnull select i, j, <b>cast(null as int)</b> from
tnull;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;===== Works fine!<br>
1 row inserted/updated/deleted<br>
<br>
Nicolas Dufour wrote:
<blockquote cite="mid4360F098.6050704@neometsys.fr" type="cite">Hi
  <br>
  <br>
I have talked with users of other bases and it seems that the statement
select null from table is standard and should work.
  <br>
  <br>
So now why i doesn't work on Derby ? not yet implemented ?
  <br>
  <br>
Thanks
  <br>
  <br>
Nicolas
  <br>
</blockquote>
</body>
</html>


Mime
View raw message