SQL Language (MOSC)

MOSC Banner

bind variables with null values

edited Mar 4, 2016 4:03AM in SQL Language (MOSC) 3 commentsAnswered

We are using Oracle 11.2.0.4 . we have the below SQL and the bind values will be passed by our application.

1) SQL -  select sum(amount) from orders where product_family in (:bind_1,:bind_2,:bind_3,:bind_4);

if all the bind values are null(not chosen in the application) this query will not return any value. however our requirement here is if all bind values are null remove that filter - show all the values

e.g


select sum(amount) from orders

-- comment out where product_family in (null,null,null,null):



Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center