TIMESTAMP and INTERVAL Types
ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated
TIMESTAMP extends DATE with fractional seconds and (optionally) a time zone; INTERVALs store durations.
How it works
TIMESTAMP(n) adds n digits of fractional seconds. TIMESTAMP WITH TIME ZONE stores an explicit offset; TIMESTAMP WITH LOCAL TIME ZONE normalises to the DB zone on store and converts to the session zone on read. Subtracting two timestamps yields an INTERVAL DAY TO SECOND. INTERVAL YEAR TO MONTH stores year/month durations. Build literals with INTERVAL '2' HOUR, INTERVAL '1-6' YEAR TO MONTH, or NUMTODSINTERVAL / NUMTOYMINTERVAL.
How it works
DECLARE
v_start TIMESTAMP := SYSTIMESTAMP;
v_gap INTERVAL DAY TO SECOND;
BEGIN
v_gap := SYSTIMESTAMP - v_start; -- a duration
DBMS_OUTPUT.PUT_LINE('elapsed: ' || v_gap);
DBMS_OUTPUT.PUT_LINE('in 90 min: ' ||
(SYSTIMESTAMP + NUMTODSINTERVAL(90, 'MINUTE')));
END;
/Related questions
GroundingGenerated
Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.