lundi 18 janvier 2010

Trigger to Prevent Dropping Objects

This trigger secures objects, preventing a user from dropping them by mistake. To begin, create a table for the example below called secured_objects with a column objectname, with datatype varchar2(20). Insert a record into this table with a value, the name of the object, which should not get dropped. Then, create the following trigger:

create or replace trigger check_beforedrop
before drop on database
declare
oname char(20);
begin
select objectname into oname from secured_objects

where upper(objectname)=ora_dict_obj_name;
if sql%found then
RAISE_APPLICATION_ERROR(-20001,'You did not want this object to be dropped');
end if;
exception
when no_data_found
then dbms_output.put_line('This object will be dropped');
end;

After this trigger is created, you cannot drop an object whose name is entered in the table. In the case where you need to drop an object, remove the entry from the secured_objects table.

3 commentaires:

  1. Каталог статей2 février 2010 à 16:28

    Remarkable topic

    RépondreSupprimer
  2. Download Movies17 mars 2010 à 09:10

    Hi
    awesome post - i'm creating video about it and i will post it to youtube !
    if you wana to help or just need a link send me email !

    RépondreSupprimer
  3. New-Insurance-73031 mars 2010 à 17:40

    hm. hope to see same more info. Can we speake about it?

    RépondreSupprimer