Should the order of the where clause affect result sets [message #2173] |
Wed, 26 June 2002 00:40 |
Anthony Wong
Messages: 2 Registered: June 2002
|
Junior Member |
|
|
Look the following 2 sqls that are accessing the same db. I would expect both of them should give me the "invalid number" error. This sql is run against Oracle 9.2. The only different is line 3 and 4 have been swopped in the 2nd sql.
Could anyone understand??
1 select COUNT(1)
2 from tb_commission_money
3 where TO_NUMBER(prem_yr) > 6
4 AND prem_yr not in ('S', 'N', 'RS')
5 --AND TO_NUMBER(prem_yr) > 6
6 -- and type_code in ('BASE')
7* -- AND IAC_BAL_MP_ID = '2297680'
SQL> /
where TO_NUMBER(prem_yr) > 6
*
ERROR at line 3:
ORA-01722: invalid number
1 select COUNT(1)
2 from tb_commission_money
3 where prem_yr not in ('S', 'N', 'RS')
4 AND TO_NUMBER(prem_yr) > 6
5 --AND TO_NUMBER(prem_yr) > 6
6 -- and type_code in ('BASE')
7* -- AND IAC_BAL_MP_ID = '2297680'
SQL> /
COUNT(1)
---------
538
|
|
|
|
|