Hello,
I'm looking to send an email notification for accounts that will expire within 14 days. To get started, I wanted to be able to query the users whose passwords will expire within 2 weeks. I wrote the following query:
select * from dba_users
where account_status = 'OPEN'
and username not in ('SYS','SYSTEM','DBSNMP')
and expiry_date < SYSDATE + 14;
However, the query is not returning the correct data:
7/28/2018 10:04:20 AM,
1/20/2018 2:30:42 PM,
3/14/2018 9:37:49 AM,
1/20/2018 2:30:31 PM,
1/20/2018 2:30:29 PM,
3/6/2018 1:36:47 PM,
3/14/2018 9:36:09 AM,
1/20/2018 2:30:31 PM,
4/19/2018 10:21:22 AM,
1/20/2018 2:30:31 PM,
3/14/2018 9:38:41 AM,
1/20/2018 2:30:42 PM,
1/20/2018 2:30:41 PM,
3/14/2018 9:35:14 AM,
1/20/2018 2:30:31 PM,
1/20/2018 2:30:41 PM,
3/14/2018 9:48:28 AM,
3/14/2018 9:37:11 AM,
8/6/2018 4:04:44 PM,
1/31/2018 11:28:50 AM,
5/2/2018 6:34:28 AM
If I run the following query to test 'SYSDATE + 14', the correct value is returned:
SQL> select sysdate, sysdate+14 from dual;
SYSDATE SYSDATE+1
--------- ---------
24-JUL-18 07-AUG-18
Any ideas why the incorrect value is not being returned?
Thanks,
Frank