What is a recommend way to write a UDM to test if a value has changed since the last run ?
A SQL based User Defined Metric
SELECT COUNT (*) FROM TAB where badvalue=TRUE and badrowtimestamp is greater than time of last run
My question is that unless I store myself the value of the time of last run in a table there is no parameter I can use for this, the poor alternative is to set it for example to 15 minutes and then use (since 15 minutes previous) . This ties the query badly back to the frequency and is not preferred.
What is a recommended way of doing this ? Do I need to store last check time and do a pl/sql block instead ?