今天想作個員工生日提醒的模塊,忽然發現語句還很差寫,因而百度總結了一下,呵呵。spa
SELECT * from 表名 where HUMANSTATE='正常在職' AND (TO_NUMBER(TO_CHAR((DATEOFBIRTH),'MM')) = TO_NUMBER(TO_CHAR((sysdate),'MM'))) AND (TO_NUMBER(TO_CHAR((DATEOFBIRTH),'DD')) BETWEEN TO_NUMBER(TO_CHAR((sysdate),'DD')) AND TO_NUMBER(TO_CHAR((sysdate),'DD'))+7)orm
紅色部分爲提醒條件,最後一個7是提早7天提醒,你能夠隨便改。it