oracle - If-else for null condition SQL -


i going create livereport using 3 example inputs:

  1. document start date
  2. document end date
  3. 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

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -