How to compare two Oracle DateTime columns

0

I have a column where I enter a date when the event happens (local storage), and the date the event is sent to my system.

The difference between the date of the event and the date of submission can not exceed 168 hours (7 days).

I'd like to select all the data that the + 168h event data is smaller than the send data.

SELECT * FROM VENDA
WHERE (DATA_VENDA+ 168HOURAS) < DATA_ENVIO_VENDA;

I'm using Oracle database.

    
asked by anonymous 15.06.2018 / 15:37

1 answer

1

You can add 7 days which is the equivalent of 168h:

SQLFiddle - Online Example:

SELECT * FROM VENDA WHERE (DATA_VENDA + 7) < DATA_ENVIO_VENDA
    
15.06.2018 / 15:56