I need to delete records inserted in the last minute and i have to use a specific system date that exists in my database and that is actually truncated (select sys_date from dual returns 20/3/2014). i tried to format the date to show minutes and then convert it again into date in order to select records inserted in the last minute using between sys_date si sys_date-1 minute, but it doesnt seem that i'm going in a good direction. for example:
select to_date(to_char((sys_date - 1 / (24 * 60)), 'DD/MM/YYYY HH24:MI:SS'),'DD/MM/YYYY HH24:MI:SS') from dual;
returns 19/3/2014 11:59:00 PM, which doesn't match my format mask and honestly i don't really understand (which is very frustrating) why as the string returned by the inner select
select to_char((sys_date - 1 / (24 * 60)), 'DD/MM/YYYY HH24:MI:SS') from dual;
returns 19/3/2014 23:59:00. any help or advice is highly appreciated:) thank you!