Subject Re: [firebird-support] How can I prevent DELETE/INSERT/UPDATE on a table
Author Helen Borrie
At 04:38 PM 1/08/2005 +0200, you wrote:
>Just curious....
>What, if I creat a before delete trigger, and depending on circumstences,
>I raise an exception? Wouldn't it keep record from deleting?

Yes. For example, you can do this:

create exception KICK_BAD_GUYS 'You are not allowed to interfere with this
data';
Commit; -- of course!

create trigger bd_kick_the_enemy for permanentstuff
active before insert or update or delete
as
begin
if (CURRENT_ROLE = 'BAD_GUYS') then
exception KICK_BAD_GUYS;
end

But how are you going to do that without the role?

./heLen