title: How to add conditional logic to an Oracle query?
body: <p>I have an Oracle query : </p>
  
  <pre><code>SELECT
    TABLE1.function_id "functionID",
    TABLE1.function_file_name "function_file_name",
    NVL(TABLE1.parameters, '') "sParams",
    NVL(TABLE3.amount, 0) "function_amount",
    NVL(TABLE2.FREE, 0) "free",
    TABLE4.customer_id "customer_id",
    TABLE4.user_name "user_name"
  FROM TABLE1
  INNER JOIN TABLE2
    ON TABLE1.function_id = TABLE2.function_id
  INNER JOIN TABLE4
    ON TABLE2.customer_user_id = TABLE4.customer_user_id
  LEFT OUTER JOIN TABLE3
    ON TABLE3.function_id = TABLE1.function_id
    AND NVL(TABLE3.start_date, SYSDATE) &lt;= SYSDATE
    AND NVL(TABLE3.end_date, SYSDATE) &gt;= SYSDATE
  WHERE function_name = 'Func1'
  AND TABLE4.user_userid = 'TEST1'
  </code></pre>
  
  <p>which will return me the below output:
  <a href="https://i.stack.imgur.com/VNtYi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VNtYi.png" alt="enter image description here"></a></p>
  
  <p>I have to add conditional logic here. </p>
  
  <p>If the above query returns data then I have to set the query result to below variables:</p>
  
  <pre><code>•   functionId 
  •   functionFilename 
  •   functionParams 
  •   isFree 
  •   chargeAmount   
  •   customerId 
  •   customerUserName
  </code></pre>
  
  <p>or else I have to return an error.</p>
  
  <p>I am new to Oracle.</p>