Skip to main content

Hi I am trying to run an SQL to select records in past 10 mins from Oracle

I have tried various methods in my sql, but none seem to work

select * from table name where updatedtime >= sysdate - interval '10' minute

select * from table name where updatedtime >= to_char(sysdate - (10/24/60), 'DD-MON-YYYY HH24:MI:SS')

I am thinking of setting a parameter to the required datetime and use it in SQL Server

Couple of queries:

1) Is startup script best place to create this parameter

2) Will SQLCreator query work with a parameter

e.g. select * from table name where updatedtime >= to_timestamp(fmeparameter, 'DD-MON-YYYY HH24:MI:SS')

where fmeparameter ='14-DEC-2018 14:00:00'

For last 10 mins in an oracle query you would normally use the folllowing.

sysdate - (10/1440)

is there a reason you don't want to use this?


For last 10 mins in an oracle query you would normally use the folllowing.

sysdate - (10/1440)

is there a reason you don't want to use this?

No, I would definitely use this. But it doesn't work when used in my sql, hence looking for a workaround with a date string which works in the same sql

 


No, I would definitely use this. But it doesn't work when used in my sql, hence looking for a workaround with a date string which works in the same sql

 

I think the bigger question is why this doesn't work in your SQL, in my opinion there's no obvious reason for it not to work. Do you get any error messages?


Try the following, notice that you shouldn't convert the result back to a string before comparison:

select * from table_name 
where updatedtime >= sysdate - (10/1440)

Reply