PL/SQL (MOSC)

MOSC Banner

Trying to use INTERVAL '1' hour to add an hour to a date

edited Nov 19, 2012 3:09AM in PL/SQL (MOSC) 3 commentsAnswered
I am trying to use INTERVAL '1' hour syntax in my pl/sql but having issues with hour value variable.
My goal For example:

start_date := to_date(start_date_in, 'YYYYMMDDHH24MISS');
end_date := to_date(start_date_in, 'YYYYMMDDHH24MISS') + INTERVAL '1' hour; -- this line works

HRS := '1';
start_date := to_date(start_date_in, 'YYYYMMDDHH24MISS');
end_date := to_date(start_date_in, 'YYYYMMDDHH24MISS') + INTERVAL HRS hour; -- does not work.  I tried to use ''1'' or some ways but it still fails.

I know that I can use + 1/24 to get the same result but wanted to explore using INTERVAL

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center