title: How to use Alias in Where clause?
body: <p>I have this procedure:</p>
  
  <pre><code> PROCEDURE P_LOAD_EXPIRED_ACCOUNT
    (
    pDayDiff IN NUMBER,
    ExpiredCur OUT MEGAGREEN_CUR
    )
    IS
    BEGIN
    OPEN ExpiredCur FOR
    SELECT 
    ACCOUNT_NAME, SERVICE_TYPE, 
        CASE 
        WHEN SERVICE_TYPE = 1 THEN ADD_MONTHS(ACTIVATED_DATE,3)
        WHEN SERVICE_TYPE = 2 THEN ADD_MONTHS(ACTIVATED_DATE,6)
        WHEN SERVICE_TYPE = 3 THEN ADD_MONTHS(ACTIVATED_DATE,12)        
         END 
         AS EXPIRED_DATE
    FROM SUBSCRIBERS
    WHERE (EXPIRED_DATE - CURRENT_DATE) &lt; pDayDiff;
    END;
  </code></pre>
  
  <p>but SQL Developer generate this error:</p>
  
  <p>Error(20,10): PL/SQL: ORA-00904: "EXPIRED_DATE": invalid identifier</p>
  
  <p>I believe that PLSQL allows me to use Alias in Where clause, but is there something I forgot?</p>
  
  <p>Thanks in advance.</p>