Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Peculiar results from a simple looking query.

Re: Peculiar results from a simple looking query.

From: <ak_tiredofspam_at_yahoo.com>
Date: 25 Feb 2005 08:36:47 -0800
Message-ID: <1109349407.102481.24500@g14g2000cwa.googlegroups.com>


look at this:

create table atable(field varchar(20))
insert into atable values ('This is a test')

select field from atable where cast(field as varchar(2))='Th' FIELD



Th

select field from atable where cast(field as varchar(4))='This' FIELD



This
/*
the predicate (cast(field as varchar(4))='This') is true the predicate (cast(field as varchar(2))='Th') is also true OK, A is true, B is true, is A AND B true? According to Oracle, no, it is not ;)
*/
select field from atable where
cast(field as varchar(4))='This'
and
cast(field as varchar(2))='Th'
0 rows selected

/* but B AND A is true ;))) */

select field from atable where
cast(field as varchar(2))='Th'
and
cast(field as varchar(4))='This'
FIELD



Th

drop table atable

OK, OK, I'll shut up and read the documentation ;))) The documentation sure says it's a feature, not a bug ;))) Received on Fri Feb 25 2005 - 10:36:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US