title: MySQL syntax checking if parameter is null
body: <p>I am looking for the way to execute MySQL statement checking if given parameter exists. As I remember I can do the following in Oracle to achieve that: </p>
  
  <pre><code>select s.* from Site s 
  where s.study = :study
  and (:enabled is null or s.enabled = :enabled)
  </code></pre>
  
  <p>is anything like that possible in MySQL too? The same code executes without error but never return any records.</p>
  
  <p>My goal here is to avoid multiple lfs and elses in my java code. It should work the way that the query looks like that when enabled parameter is null:</p>
  
  <pre><code>select s.* from Site s 
  where s.study = :study
  </code></pre>
  
  <p>and like that if the parameter is not null:</p>
  
  <pre><code>select s.* from Site s 
  where s.study = :study
  and s.enabled = :enabled
  </code></pre>
  
  <p>and I want to do that with a single query</p>