Custom expression

Guys

I have a scheduled task that runs in some software that sits on top of oracle I wanted this task to run until 9pm at night then start running again at 9am but its not

what it seems to do is run until 9pm which is great but it then starts again at 6am

here is the code

decode(sign(sysdate - (trunc(sysdate) + 21/24)), 1, (trunc(sysdate) + 30/24), (sysdate + 120/1440))

any ideas
DarrenJacksonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert GOracle dbaCommented:
you could write an expression to test it :
generate some hours for sysdate ...

select
  decode(sign(nsysdate - (trunc(nsysdate) + 21/24)), 1, (trunc(nsysdate) + 30/24), (nsysdate + 120/1440)) colname
from (select sysdate + 1/24*level nsysdate from dual connect by level < 25);  

output:
COLNAME
30/09/2013 13:46:49
30/09/2013 14:46:49
30/09/2013 15:46:49
30/09/2013 16:46:49
30/09/2013 17:46:49
30/09/2013 18:46:49
30/09/2013 19:46:49
30/09/2013 20:46:49
30/09/2013 21:46:49
30/09/2013 22:46:49
1/10/2013 6:00:00
1/10/2013 6:00:00
1/10/2013 6:00:00
1/10/2013 2:46:49
1/10/2013 3:46:49
1/10/2013 4:46:49
1/10/2013 5:46:49
1/10/2013 6:46:49
1/10/2013 7:46:49
1/10/2013 8:46:49
1/10/2013 9:46:49
1/10/2013 10:46:49
1/10/2013 11:46:49
1/10/2013 12:46:49
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DarrenJacksonAuthor Commented:
never thought of that

Ill try this out

Thanks
0
DarrenJacksonAuthor Commented:
Great got it working

decode(sign(sysdate - (trunc(sysdate) + 20/24)), 1, (trunc(sysdate) + 33/24), (sysdate + 120/1440))

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.