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!

Handle null IN param in SQL WHERE clause

2925862Apr 9 2015 — edited Apr 9 2015

Hi all,

Oracle 11g R2.

How do you handle null IN param in SQL WHERE clause? My suggestions:

1] select value into variable from table t where (in_param is null or t.column = in_param);

2] select value into variable from table t where column = nvl(in_param, column);

what is better? Other choices? Impact on indexes etc.?

Thanks

Rob

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2015
Added on Apr 9 2015
4 comments
2,141 views