0

im new to oracle sql. My problem is my tabe created unnecessary records daily, and i want to execute this query everyday. Is there anyway to do it in oracle sql developers ?

delete * from my_table where my_date > to_char(sysdate+1,'YYYYMMDD');

I have created jobs but it failed. And i tried to create a procedure to call it from a job but a procedure required to declare IN and OUT variables which i dont really need for this task.

  • Use a scheduled job and fix the syntax of your query using `DELETE FROM my_table WHERE my_date >= TRUNC(sysdate) + 1;` to delete everything where `my_date` is after the current day (or `+2` if you want everything after tomorrow). – MT0 Apr 09 '23 at 19:52
  • @MT0: You are of course assuming that the `my_date` column is of type `DATE`. While this would be true of any well-designed database, there's no guarantee we're dealing with one here... – Luke Woodward Apr 09 '23 at 20:28

0 Answers0