Or use the INTERVAL
function. It has the same result but I think it reads more clearly - that's of course just an opinion :)
SELECT MAX(D_DTM) - INTERVAL '1' HOUR FROM tbl1
The nice thing about the INTERVAL
function is that you can make the interval be years, months, days, hours, minutes or seconds when dealing with a DATE
value, though the month interval can be tricky when dealing with end-of-month dates.
And yes, the quote around the 1
in the example is required.
You can also use the Oracle-specific NumToDSInterval
function, which is less standard but more flexible because it accepts variables instead of constants:
SELECT MAX(D_DTM) - NUMTODSINTERVAL(1, 'HOUR') FROM tbl1