i'm wondering if you can keep pinging a oracle table until a row is put into a table or removed.
I wish to start the following action once i obtain a confirmation the row continues to be added or removed. Perferred technique is a question that keeps pinging until it takes place. normally when querying i personally use executeQuery method but that only return if this has results
I've not found a technique yet that's able to perform that.
The same is true anybody know a method to do that?
In Oracle 11g you could utilize Database Change Notification. Rather than polling the database to check on for changes, you register to get a celebration whenever a change happens. There's a resource code example here.
If you opt to poll rather, then you should look at your query carefully. For instance, depending on quantity of rows within the table -
SELECT COUNT(*) FROM your_table - may offer you the incorrect answer when the same quantity of rows were added and taken off the table between two accomplishments of the query.
I am unfamiliar with Oracle, and so i will suggest a database independent approach.
Would you remove or "inactivate" records inside your tables? Should you "inactivate", you can conserve a "Version" column in each and every row,
++'ing in each and every CUD operation. For instance, whenever you produce a new row, it's version is
1. Following the first update is
2 so it continues.
This way, rather than depending on
SELECT COUNT(*) ..., you can depend on
SELECT SUM(VERSION) .... )
You might readily Audit Trail - auditing every CUD operation in each and every table -, and poll the audit trail rather than the tables.