Polling Updated Records from Database (SQL , Oracle)

Tuesday, July 5, 2011
Q: Polling Updated Records from Database (SQL , Oracle)

I need to poll updated records at each interval of time from a database server there will be records added to the database at random intervals of time so i need to pick up those new added record's each time when i poll (if any exists)

Ans:

If you are using Polling with the WCF SQL/Oracle adapter. You can have 2 queries in the statement. First would select the records and just after selecting based on the crieteria update them. For e.g. if you have a status field in the table select the records based on status (where status = 'UNREAD') and after the select query have an update query (update status where status='READ').

There may be a situation where you would not like to modify the table and would only read the data. But it should be on the database side that you should pick only certain records (based on the crieteria) and should not pick the similar records in the second cycle as you won't require them for processing. Find a way if you can determine this situation.

Another approach would be to store the primary key into another table (of your database which you can modify) and have a status column with them. Then you can have a join which would determine not to pick up the records which were previously processed

No comments:

Post a Comment

Post Your Comment...