-- 已经过了生日的人 select * from employe where TO_CHAR(Born,'DDD') < TO_CHAR(SYSDATE,'DDD'); -- 未过生日的人 select * from employe where TO_CHAR(Born,'DDD') > TO_CHAR(SYSDATE,'DDD');
select tmp2.*, case when to_char(Born, 'mmdd')>to_char(sysdate, 'mmdd') then '未过' when to_char(Born, 'mmdd')<to_char(sysdate, 'mmdd') then '已过' when to_char(Born, 'mmdd')=to_char(sysdate, 'mmdd') then '今天' end from tmp2
select * from employe where TO_CHAR(Born,'DDD') < TO_CHAR(SYSDATE,'DDD');
-- 未过生日的人
select * from employe where TO_CHAR(Born,'DDD') > TO_CHAR(SYSDATE,'DDD');
when to_char(Born, 'mmdd')>to_char(sysdate, 'mmdd') then '未过'
when to_char(Born, 'mmdd')<to_char(sysdate, 'mmdd') then '已过'
when to_char(Born, 'mmdd')=to_char(sysdate, 'mmdd') then '今天'
end
from tmp2