Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NVL is not working properly

Rajesh123Nov 20 2018 — edited Nov 20 2018

Hi All,

I have data like this and used nvl with using parameter , but it is not populating both records if am not passing p_vendor.

vendor column has null value for 1111 for serial_num.

with xxc_test

as

(select null vendor, '1111' serial_num from dual

union all

select 'ABC' vendor, '2222' serial_num from dual

)

select * from xxc_test

where 1=1

and vendor=nvl(:p_vendor,vendor)

and to_char(serial_num) in('2222','1111')

This post has been answered by Frank Kulash on Nov 20 2018
Jump to Answer
Comments
Post Details
Added on Nov 20 2018
6 comments
598 views