0

I have a query like this:

Insert into UNITRIP (START_TIME, END_TIME)
   (TO_DATE('10/20/2015 06:05:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/20/2015 07:34:06', 'MM/DD/YYYY HH24:MI:SS')

I require a sql where the start_time is of this type: system-date 06:05:00 (fixed date is to be replaced by sysdate).

How to write a query for this?

1 Answer 1

3

If you're asking for an expression that returns 6:05am on the current day

trunc(sysdate) + interval '6:05' hour to minute
3
  • Justin, I want to write an insert SQL that is a replacement for the query i wrote. Except that the date portion is replaced by system date
    – LoneWolf91
    Commented Nov 3, 2015 at 13:02
  • 1
    @LoneWolf91 - It sounds like you just want to replace the to_date expressions with the expression I posted (you'd obviously need to adjust the interval to produce a different time). If that is not actually what you want, I'm afraid that you'll probably need to clarify your question. Commented Nov 3, 2015 at 13:04
  • Okay, this works. I specifically required this: trunc(sysdate) + interval '6:05:00' hour to seconds. Thanks Justin
    – LoneWolf91
    Commented Nov 3, 2015 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.