I guess (sorry, but you haven't described this), that you need to compare timestamp column with the current_timestamp based on the interval, that is calculated from columns INTERVALL and REPETITIONS. I also think that in the first case you have something to do with week intervals, and months in the second snippet. (I don't fully understand the logic behind TRUNC(…) parts of your code.