6 Replies Latest reply: Apr 11, 2012 4:39 AM by indra budiantho RSS

    Case or Decode in the Where clause

    roots
      Dear all,

      My requirement is:

      If user select other then "ALL"option from the LOV the following condition should be part of the where clause.
      current_req_status = :block1.req_status
      If user select "ALL" from the lov no need to append the above condition in the where clause.
      Please give me the sample code


      select request_id,doc_name,doc_code,part_id,current_req_status from  test_table
      where req_type = 'I' 
      and doc_code = :BLOCK1.doc_code
      and  -- Here is the condition is changed based on 
              the :BLOCK1.req_status(LOV).
           -- If user select other then  "All" option from 
              this LOV the query append the below condition
            
              current_req_status = :block1.req_status
      
            -- Else no need append the above condition 
               in the query where clause.
      Edited by: roots on Apr 10, 2012 9:31 AM

      Edited by: roots on Apr 10, 2012 9:38 AM