I have a table called SALES_ORDER.Data gets refreshed and new data keeps coming in in this table. I want to write a trigger to fetch last 15 minutes of data from this table and insert it into another backup table/staging table(maybe called TEMP) .
This is what I am trying
CREATE OR REPLACE TRIGGER FETCH_DATA
AFTER DELETE OR INSERT OR UPDATE ON UFD_BASE.SALES_ORDER
BEGIN
IF UPDATE_DATE > sysdate - interval '15' minute
...
NULL;
END;
but its not correct or complete. I dont have much knowledge regarding triggers or sql. Can anybody please help me figure out how to do this?
Trigger isn't the right tool to do that. It fires upon certain action on a table - when row(s) get inserted, updated or deleted - not every 15 minutes.
For such a purpose, you should
Procedure would then be e.g.
To schedule it, use
dbms_scheduler(ordbms_job, if you have really old Oracle database version), e.g.