Sql results wrong in Oracle 11G
HI,
When running the below testcode ,the select statement is giving results is 10g,but not in oracle 11g
create table line_detail
( ld_batch varchar2(10) not null,
ld_order varchar2(10),
ld_description varchar2(100));
insert into line_detail(ld_batch, ld_order, ld_description)
values('B01', null, 'Invoice analysis');
commit;
10g
---------:
SQL> select *from line_detail
where ld_batch = 'B01'
and NVL(ld_order, 'P123') is not null
and NVL(ld_order, 'P123') = 'P123'; 2 3 4 5
LD_BATCH LD_ORDER
---------- ----------
LD_DESCRIPTION
--------------------------------------------------------------------------------
B01
Invoice analysis
11g:
------------
SQL> select *
2 from line_detail
3 where ld_batch = 'B01'
create table line_detail
( ld_batch varchar2(10) not null,
ld_order varchar2(10),
ld_description varchar2(100));
insert into line_detail(ld_batch, ld_order, ld_description)
values('B01', null, 'Invoice analysis');
commit;
10g
---------:
SQL> select *from line_detail
where ld_batch = 'B01'
and NVL(ld_order, 'P123') is not null
and NVL(ld_order, 'P123') = 'P123'; 2 3 4 5
LD_BATCH LD_ORDER
---------- ----------
LD_DESCRIPTION
--------------------------------------------------------------------------------
B01
Invoice analysis
11g:
------------
SQL> select *
2 from line_detail
3 where ld_batch = 'B01'
1