문제

I have oracle 10g database in my application. How to find out that how many times the a particular records has been accessed in particular table.

도움이 되었습니까?

해결책

In general, to do that, you need to access records in a table though stored procedure, not through SELECT statement.

But, here is how it could be simplified:

  1. you add a requirement that any SELECT to your table should have a function call:

    select yourtable.* from yourtable
    where yourfunct('yourtable', yourtable.key) = 'done'
    

    this could be easily done through view plus revoking permissions to read the table itself

  2. in your function, you either save table/key pair inside a table in a package (you don't need to start a transaction to do that) or you start an autonomous transaction and write into a real table.

    writing into a variable in a package is not thead safe, but it is much faster.

    creating a transaction is slooooooower, but it will garantie a result.

My personal preference would be to question an original task. Maybe it would be enough to create sort of 'log entry' table where requests for data are recorded.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top