how to implement if else functionality in Sql : i have an SQL query in which i have customer_id, User_id and name, the values will be provided from java class while calling the query.
the scenario here is if i have customer_id then i should only consider customer_id and need not consider user_id and name, if customer_id is null then i have to consider user_id and if user_id id null i have to consider name 

right now this logic is implemented in java if else statement i want this logic to be moved to SQL query itself, following is the code 

    String query = "SELECT * FROM CUSTOMER WHERE "
    if(customer!=null && customer.length!=0)
          query = query+"AND CUSTOMER_ID LIKE '"+customer+"%'";
    else if(user!=null && user.length!=0)
          query = query+"AND USER_ID LIKE '"user+"%'";
    else if(name!=0 && name.length!=0)
          query = query + "AND NAME LIKE '"+name+"%'";

Thanks in advance
