dbTalk Databases Forums  

Inserting surname of Null from a subquery results in a NULL value

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Inserting surname of Null from a subquery results in a NULL value in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jbainbridge@gmail.com
 
Posts: n/a

Default Inserting surname of Null from a subquery results in a NULL value - 12-10-2004 , 10:07 AM






Okay first up this is not a NULL vs. Empty String thing as I am well
aware of that little gotcha but instead it is when a 'Null' string (a
person's surname is actually Null) is returned by a subquery to be used
in an insert or update statement it is actually inserting a NULL value
instead of the text Null.

Does anyone know a way around this amusing problem?

Cheers,
--
Jason Bainbridge
KDE - Conquer Your Desktop - http://kde.org
KDE Web Team - webmaster@kde


Reply With Quote
  #2  
Old   
Frank Piron
 
Posts: n/a

Default Re: Inserting surname of Null from a subquery results in a NULL value - 12-10-2004 , 10:37 AM






10 Dec 2004 08:07:32 -0800 <jbainbridge (AT) gmail (DOT) com> wrote:

Quote:
Okay first up this is not a NULL vs. Empty String thing as I am well
aware of that little gotcha but instead it is when a 'Null' string (a
person's surname is actually Null) is returned by a subquery to be used
in an insert or update statement it is actually inserting a NULL value
instead of the text Null.

Does anyone know a way around this amusing problem?

Cheers,
--
Jason Bainbridge
KDE - Conquer Your Desktop - http://kde.org
KDE Web Team - webmaster@kde

SQL*Plus: Release 3.3.2.0.2 - Production

Copyright (c) Oracle Corporation 1979, 1996.

Verbunden mit:
Oracle8i Enterprise Edition Release 8.1.7.4.0
With the Partitioning option
JServer Release 8.1.7.4.0 - 64bit Production

SQL> update emp
2 set ename='Null'
3 where
4 empno=7369;

1 Zeile wurde aktualisiert.

SQL> update emp eo
2 set eo.ename=
3 (select ei.ename from emp ei
4 where ei.empno=7369)
5 where
6 eo.empno=7844;

1 Zeile wurde aktualisiert.

SQL> select ename
2 from emp
3 where empno=7844;

ENAME
----------
Null

SQL>


Any triggers working behind the scene?
--
Frank Piron,
defrankatkonaddot
(leftrotate two)


Reply With Quote
  #3  
Old   
ak_tiredofspam@yahoo.com
 
Posts: n/a

Default Re: Inserting surname of Null from a subquery results in a NULL value - 12-10-2004 , 11:04 AM



I don't see the problem:

CREATE TABLE a(n VARCHAR2(30))
Table created

INSERT INTO a VALUES('Null')
1 row inserted


SELECT N,
CASE WHEN n IS NULL THEN 'n IS NULL' ELSE 'n IS NOT NULL' END IS_NULL
FROM a
N IS_NULL
------------------------------ -------------
Null n IS NOT NULL
1 row selected


DROP TABLE a
Table dropped


Reply With Quote
  #4  
Old   
DA Morgan
 
Posts: n/a

Default Re: Inserting surname of Null from a subquery results in a NULL value - 12-10-2004 , 08:02 PM



jbainbridge (AT) gmail (DOT) com wrote:

Quote:
Okay first up this is not a NULL vs. Empty String thing as I am well
aware of that little gotcha but instead it is when a 'Null' string (a
person's surname is actually Null) is returned by a subquery to be used
in an insert or update statement it is actually inserting a NULL value
instead of the text Null.

Does anyone know a way around this amusing problem?

Cheers,
--
Jason Bainbridge
KDE - Conquer Your Desktop - http://kde.org
KDE Web Team - webmaster@kde
No problem with any of my databases ... look for something else ...
a constraint, trigger, etc.

--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)


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.