sqlsql-timestamporacle-apex-23

Selecting record based on TIMESTAMP column in oracle


I have the table contains column create_datetime.It is timestamp(6) data type.

I used the below query to fetch the create_datetime-15 days records

The table having records for this condition But it is not listing for below query

SELECT create_datetime 
FROM xy
WHERE create_datetime <= create_datetime-15 

Solution

  • Specify the units of the subtraction:

    create_datetime - NUMTODSINTERVAL(15, 'DAY')