I'm passing 3 parameters into my Hana Stored Procedure to use as WHERE
clauses, and if the parameter is null
, I want the procedure to behave as though that condition doesn't exist.
example:
if one of the input parameters is deviceType.
SELECT TOP 5 DISTINCT USERS FROM MYTABLE
WHERE USERDEVICE = deviceType;
if deviceType is null, query should simply be
SELECT TOP 5 DISTINCT USERS FROM MYTABLE.
I know I can achieve this with if statements, but is there another way to do it?