title: How do I decode a row of data using a date range as my parameter
body: <p>I am trying to do a decode against an Oracle server and return a fiscal year if date ranges fall in between what is listed below.  I keep getting 'ORA-00907: missing right parenthesis' and I am sure it is something simple or maybe I am not using correct syntax for the date range but any help would be appreciated.  Thanks!</p>
  
  <pre><code>SELECT ISSUE_DT,
  MAX(DECODE(ISSUE_DT &gt;= '01-JUL-11' AND ISSUE_DT &lt;= '30-JUN-12','2012',ISSUE_DT &gt;= '01-JUL-12' AND ISSUE_DT &lt;= '30-JUN-13','2013',ISSUE_DT &gt;= '01-JUL-13' AND ISSUE_DT &lt;= '30-JUN-14','2014','NONE'))FISCAL_YEAR
  FROM PS_GSU_AWD_INFO_VW
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>This is my current SQL statement that returns two columns, the year with quarter and total amount.  I ultimately need the quarter and fiscal year in two separate places:</p>
  
  <pre><code>select CASE 
  WHEN ISSUE_DT &gt;= '01-JUL-11' AND ISSUE_DT &lt;= '30-SEP-11' THEN 'FY12 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-11' AND ISSUE_DT &lt;= '31-DEC-11' THEN 'FY12 Q2'
  WHEN ISSUE_DT &gt;= '01-JAN-12' AND ISSUE_DT &lt;= '31-MAR-12' THEN 'FY12 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-12' AND ISSUE_DT &lt;= '30-JUN-12' THEN 'FY12 Q4' 
  WHEN ISSUE_DT &gt;= '01-JUL-12' AND ISSUE_DT &lt;= '30-SEP-12' THEN 'FY13 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-12' AND ISSUE_DT &lt;= '31-DEC-12' THEN 'FY13 Q2' 
  WHEN ISSUE_DT &gt;= '01-JAN-13' AND ISSUE_DT &lt;= '31-MAR-13' THEN 'FY13 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-13' AND ISSUE_DT &lt;= '30-JUN-13' THEN 'FY13 Q4' 
  WHEN ISSUE_DT &gt;= '01-JUL-13' AND ISSUE_DT &lt;= '30-SEP-13' THEN 'FY14 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-13' AND ISSUE_DT &lt;= '31-DEC-13' THEN 'FY14 Q2' 
  WHEN ISSUE_DT &gt;= '01-JAN-14' AND ISSUE_DT &lt;= '31-MAR-14' THEN 'FY14 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-14' AND ISSUE_DT &lt;= '30-JUN-14' THEN 'FY14 Q4' 
  ELSE 'NO DATA' END AS FISCAL_QUARTER, SUM(AMOUNT) AS TOTAL_AWARDED FROM PS_GSU_AWD_INFO_VW WHERE ISSUE_DT &gt;= '01-JUL-11' 
  GROUP BY CASE WHEN ISSUE_DT &gt;= '01-JUL-11' AND ISSUE_DT &lt;= '30-SEP-11' THEN 'FY12 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-11' AND ISSUE_DT &lt;= '31-DEC-11' THEN 'FY12 Q2' 
  WHEN ISSUE_DT &gt;= '01-JAN-12' AND ISSUE_DT &lt;= '31-MAR-12' THEN 'FY12 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-12' AND ISSUE_DT &lt;= '30-JUN-12' THEN 'FY12 Q4' 
  WHEN ISSUE_DT &gt;= '01-JUL-12' AND ISSUE_DT &lt;= '30-SEP-12' THEN 'FY13 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-12' AND ISSUE_DT &lt;= '31-DEC-12' THEN 'FY13 Q2' 
  WHEN ISSUE_DT &gt;= '01-JAN-13' AND ISSUE_DT &lt;= '31-MAR-13' THEN 'FY13 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-13' AND ISSUE_DT &lt;= '30-JUN-13' THEN 'FY13 Q4' 
  WHEN ISSUE_DT &gt;= '01-JUL-13' AND ISSUE_DT &lt;= '30-SEP-13' THEN 'FY14 Q1' 
  WHEN ISSUE_DT &gt;= '01-OCT-13' AND ISSUE_DT &lt;= '31-DEC-13' THEN 'FY14 Q2' 
  WHEN ISSUE_DT &gt;= '01-JAN-14' AND ISSUE_DT &lt;= '31-MAR-14' THEN 'FY14 Q3' 
  WHEN ISSUE_DT &gt;= '01-APR-14' AND ISSUE_DT &lt;= '30-JUN-14' THEN 'FY14 Q4' 
  ELSE 'NO DATA'  END ORDER BY FISCAL_QUARTER
  </code></pre>