Query not recognize alias I have the following query, the alias it's called DELAY, works fine, but when I try to run the first query adding AND DELAY &lt; 0, the alias is not recognized.

I tried to create the alias QUERY AS DELAY or QUERY AS "DELAY" but no success.

The strange thing is that the alias DELAY in the order by doesn't generate errors.

 SELECT ITK_TCK_ID, 
                   ITK_OPENED_DATE, 
                   TO_NUMBER(ROUND(ROUND(GET_HS(ITK_OPENED_DATE, 
                                                SYSDATE, 
                                                ITK_NORMAL_BEGIN, 
                                                ITK_NORMAL_END, 
                                                ITK_WEEKEND_BEGIN, 
                                                ITK_WEEKEND_END, 
                                                ITK_FREEDAY_BEGIN, 
                                                ITK_FREEDAY_END), 
                                         GET_HS(ITK_OPENED_DATE, 
                                                SYSDATE, 
                                                ITK_NORMAL_BEGIN, 
                                                ITK_NORMAL_END, 
                                                ITK_WEEKEND_BEGIN, 
                                                ITK_WEEKEND_END, 
                                                ITK_FREEDAY_BEGIN, 
                                                ITK_FREEDAY_END)) - 
                                   ITK_EXPIRATION_TIME, 
                                   2)) DELAY 
              FROM INSTANTIATED_TICKLERS 
             WHERE ITK_AR_SBP_ID = 'PEAJU_PP' -- P_WGR_ID 
             AND DELAY &lt; 0 
             ORDER BY DELAY DESC;


Any suggestions?
That's because the WHERE executes before the SELECT. You could try calculating  DELAY inside the WHERE 

WHERE ITK_AR_SBP_ID = 'PEAJU_PP' -- P_WGR_ID 
AND TO_NUMBER(ROUND(ROUND(GET_HS(ITK_OPENED_DATE, 
             SYSDATE, 
             ITK_NORMAL_BEGIN, 
             ITK_NORMAL_END, 
             ITK_WEEKEND_BEGIN, 
             ITK_WEEKEND_END, 
             ITK_FREEDAY_BEGIN, 
             ITK_FREEDAY_END), 
        GET_HS(ITK_OPENED_DATE, 
             SYSDATE, 
             ITK_NORMAL_BEGIN, 
             ITK_NORMAL_END, 
             ITK_WEEKEND_BEGIN, 
             ITK_WEEKEND_END, 
             ITK_FREEDAY_BEGIN, 
             ITK_FREEDAY_END)) - 
        ITK_EXPIRATION_TIME, 
      2) &lt; 0