oracle - If-else for null condition SQL -
i going create livereport using 3 example inputs:
- document start date
- document end date
- emp id
these 3 rows in sql table documentdata.
what want reproduce following:
if user not put value in "emp id" field, should show "document start date" , "document end date". otherwise, values corresponding "emp id" should shown.
it may simple still need query.
perhaps solution:
-- should work select * documentdata case when :emp_id null 1 -- attention :emp_id introduced in stead of emp_id when emp_id = :emp_id 1 else 0 end = 1
the :emp_id
should variable comes application (the field being altered user). 1
in case when
statement acts true
condition.
Comments
Post a Comment