March 20, 2008 at 2:06 pm
When I use following command I get some result. Field1 is the integer type. Looks to me that field1 is storing space in it.
SELECT TOP 1 * FROM TABLENAME WHERE FIELD1 = ''
March 21, 2008 at 6:23 am
That is more-or-less the expected behavior. Keep in mind that '' can be auto converted to zero. For example:
declare @test-2 table(field1 int)
insert into @test-2 values(11)
insert into @test-2 values(12)
insert into @test-2 values('') -- Inserts zero
select * from @test-2
/* -------- Base Table: --------
field1
-----------
11
12
0
*/
select top 1 * from @test-2 where field1 = ''
/* ------ Results: --------
field1
-----------
0
*/
March 21, 2008 at 8:34 am
Thanks buddy,
I did the same test and also if do following command like
select * from tablename where field1 = '1'
you will get the result .
I think this kind of behaviour is not in Oracle.
March 21, 2008 at 8:41 am
I think you are right; with Oracle I got:
select *
from
( select 0 as field1 from dual union all
select 1 as field2 from dual
)
where field1 = '';
/* -------- Output with '0' --------
FIELD1
----------
*/
select *
from
( select 0 as field1 from dual union all
select 1 as field2 from dual
)
where field1 = '1'
/* -------- Output with '1' --------
FIELD1
----------
1
*/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply