I want to delete all records older than 24 hours. I'm using the query below for the same, but sometimes it does not have to go completely. I want to know whether my query is true or false? Or what's the better way to do this.
Remove from TEMP_SERVICE_OPTION where EVENT_DATE & lt; TRUNC (SYSDATE) - 1;
if you want more than 24 hours :
where event_date & lt; So Sysdate - 1 If you want to before yesterday, to:
where event_date & lt; Trunc (sysdate) - 1 For display, it depends on how many rows are being removed. If you have only thousands of rows in your table, then it's okay. If it has millions of lines, you might want an index at event_date . Or, you might also want to take a different approach - selecting the data in the temporary table, minimizing the original table, and then inserting it again.
No comments:
Post a Comment