I have trigger
BEFORE UPDATE ON USER_ROLES
I know that if I write "SELECT FROM USER_ROLES" in the trigger, I will have "mutating, trigger/function error". This is true, no problem! If I select from the same table that I am updating, I will have that error - I know that, that's nice.
But I should select (there is no way) the same table in order to detect whether user have access to update the table or not. For instance:
BEGIN
/* check if update causes loop in tree */
SELECT count(rol.id) INTO cnt
FROM USER_ROLES rol
WHERE rol.id=:old.id
START WITH rol.id = :new.parent_id
CONNECT BY PRIOR rol.id = rol.parent_id ;
IF( cnt > 0 )
THEN
....
END IF;
....
END;
I know that there will be "mutating, trigger/function error" but where is solution? before update, how to check whether client have permission or not? Can I do the similar without writing "SELECT"?