Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Questions re subqueries
[Lex would have loved this one...]
Bill,
I'm assuming you are confused over the fact that the result set of the second query (with the NOT exists) holds the t1 tuple with the NULL "value"?
The result of your second query is correct... (doesn't Oracle support confirm this?)
Remember NULL = NULL evaluates to FALSE in SQL's 3-valued logic. Therefore it is true that for the tuple in t1 that holds the NULL "value", the predicate (in the where clause) "not exists (select 'x' from oracle.t1_at_bill_testx a where a.c1 = t1.c1)" evaluates to TRUE. And therefore it (the NULL-tuple) shows up in the result set (next to the tuple with value 3 for c1).
This has nothing to do with database links, TDE, or whatever.
The fact that the alter session command changes the result set of the 2nd query to a incorrect result set, is obviously a bug which probably *does* have to do with db-links, TDE, etc.
Toon
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of William Wagman
Sent: woensdag 20 juni 2007 1:32
To: oracle-l_at_freelists.org
Subject: Questions re subqueries
Greetings,
I am struggling to get my head wrapped around an issue which is confusing me greatly. I hope I can articulate this properly but given my confusion I may muddy the waters here. I have two 10.2.0.3.0 databases, the local one on Linux and a remote one on Solaris. I don't think platform is involved but one never knows. On each database I have a simple table with one column, varchar2 encrypted using TDE on the local node, unencrypted (TDE not implemented) on the remote node. Each table has one row with null values.
Local...
SQL> desc t1
Name Null? Type ----------------------------------------- --------SQL> select count (*) from t1;
----------------------------
C1 VARCHAR2(2) ENCRYPT
4
SQL> select * from t1;
C1
--
1
2
3
Remote...
SQL> desc oracle.t1_at_bill_testx
Name Null? Type ----------------------------------------- --------SQL> select count (*) from oracle.t1_at_bill_testx; COUNT(*)
----------------------------
C1 VARCHAR2(2)
4
SQL> select * from oracle.t1_at_bill_testx;
C1
--
1
2
5
Now I execute the following selects, both from the local database...
SQL> select * from t1 where exists
2 (select 'x' from oracle.t1_at_bill_testx a where a.c1 = t1.c1);
C1
--
1
2
2 rows selected.
SQL> select * from t1 where not exists
2 (select 'x' from oracle.t1_at_bill_testx a where a.c1 = t1.c1);
C1
--
3
2 rows selected.
The second one is not really what I would expect but this is where I start to get confused and am hoping someone can shed some light on the situation for me. The issues are...
C1
--
1
2
3
4 rows selected.
What I don't understand is the relation between the variables, TDE, the nulls and the _unnest_subquery parameter. I am quite confused. If anyone can shed some light on this and explain to me what is going on I would greatly appreciate it.
Thank you.
Bill Wagman
Univ. of California at Davis
IET Campus Data Center
wjwagman_at_ucdavis.edu
(530) 754-6208
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jun 20 2007 - 02:56:40 CDT
![]() |
![]() |