bbowen14
bbowen14

Reputation: 47

Only want report to load last 30 min of data

I am trying to have an APEX report show only responses submitted in the last 30 minutes. Is it possible to do this with the where clause?

I originally tried using a trigger that feed into a creation date column but I had issues with data showing up into the column and was unable to have the report only show the past 30 minutes.

Any ideas would be helpful,

Thanks!

    select SCRAP_DATE,
           PAINT_SHOP,
           IGEF,
           GIRDER,
           MODEL,
           COLOR,
           SCRAP_OWNER,
           sysdate
    from SCRAP_BODY_SYSTEM
    where sysdate >= (current_timestamp - interval '30' minute)

Upvotes: 0

Views: 823

Answers (2)

Littlefoot
Littlefoot

Reputation: 143023

where clause is the way to do it, e.g.

where date_column >= sysdate - interval '30' minute

because of this:

SQL> select sysdate,
  2         sysdate - interval '30' minute half_an_hour_ago
  3  from dual;

SYSDATE          HALF_AN_HOUR_AGO
---------------- ----------------
04.05.2022 14:37 04.05.2022 14:07

SQL>

sysdate vs. current_timestamp:

SQL> select sysdate, current_timestamp from dual;

SYSDATE             CURRENT_TIMESTAMP
------------------- -------------------------------
05.05.2022 07:48:19 05.05.22 07:48:19,200858 +02:00

SQL>

Upvotes: 2

karthik_ghorpade
karthik_ghorpade

Reputation: 374

I believe you could use a where condition which would be something like:

where submitted_datetime >= (current_timestamp - interval '30' minute)

Do let me know if it works!

Upvotes: 0

Related Questions