title: Stored Procedure PL SQL If String Is blank
body: <p>I got a problem with Oracle Stored Procedure. The <code>if else</code> statement didnt check whether the string is blank or not. Or am I doing it wrong?</p>
  
  <pre><code>create or replace PROCEDURE GET_ICECREAM
  (
     flavour IN VARCHAR2,
     toppings IN VARCHAR2,
     cursorIC OUT sys_refcursor
  )
  AS
  
  dynaQuery VARCHAR2(8000);
  
  BEGIN
  
  dynaQuery := 'SELECT price FROM tblIceCream';
  
  IF flavour &lt;&gt; '' THEN
  
     dynaQuery := dynaQuery || ' WHERE flavour LIKE '''%''' '
  
  ENDIF
  
  
  
  OPEN cursorIC FOR dynaQuery;
  
  END GET_ICECREAM;
  </code></pre>
  
  <p>DISCLAIMER: Above is not actual stored procedure. I'm using an example to understand concept of if else and native dynamic SQL in Oracle. So that its easier for you guys to understand ;)</p>