title: Define date variable in Oracle
body: <p>How to define date variable and assign that variable from the table in oracle?</p>
  
  <p>I tried below</p>
  
  <pre><code>DEFINE EXTRACTION_DATE = SELECT DATA_EXTRACTION_DATE FROM tbl1
  
  SELECT PA.PERSON_ID,A.PERIOD_END_DATE,PA.OPT_OUT_OF_PLAN_DATE,A.TERMINATION_DATE,
          CASE WHEN A.PERIOD_END_DATE &lt;= ADD_MONTHS(TRUNC(&amp;EXTRACTION_DATE), -3) THEN 'Y'  ELSE 'N' END 
      FROM 
      tbl2
  </code></pre>
  
  <p>it throwing invalid statement error.</p>
  
  <p>its not duplicate of another. Because I need to get variable from the table not by static variable.</p>