What is the best way to handle optional parameter if null value is passed in select query in oracle
E.g. select * from emp where deptno = 10 and empno in (7782,7934)
In above query, if user will not select any empno then it should fetch all records where deptno = 10
Here is a little bit dirty solution for your problem if you just want to instert the value into the string:
Here
%user_input%is a placeholder for values, selected by user and%not_used_value%isempnoid, which is never used.So, the resulting query could look like this: