create or replace package manage_triggers_package is
function manage_triggers(p_tablename varchar2,p_action varchar2) return varchar2;
function manage_triggers(p_trigger_name varchar2) return varchar2;
end manage_triggers_package;

create or replace package body manage_triggers_package is
function manage_triggers(p_tablename varchar2,p_action varchar2) return varchar2
as
nu_exista_tabela exception;
alter_gresit exception;
optiune_gresita exception;
PRAGMA EXCEPTION_INIT(nu_exista_tabela,-00942);
PRAGMA EXCEPTION_INIT(optiune_gresita,-01735);
PRAGMA EXCEPTION_INIT(alter_gresit,-00940);
begin
if p_action='disable' then
execute immediate 'ALTER TABLE '||p_tablename || ' DISABLE ALL TRIGGERS';
return 'the triggers were disabled';
end if;
if p_action='enable' then
execute immediate 'ALTER TABLE '||p_tablename || ' ENABLE ALL TRIGGERS';
return 'the triggers were enabled';
end if;
exception 
when nu_exista_tabela then return ('nu exista tabela');
when optiune_gresita then return('optiunea pt alter table e gresita; verifica spatiile!');
when alter_gresit then return('comanda alter trigger e gresita; verifica spatiile!');
end manage_triggers;


function manage_triggers(p_trigger_name varchar2) return varchar2
as
nu_exista exception;
alter_gresit exception;
optiune_alter exception;
pragma exception_init(optiune_alter,-00922);
PRAGMA EXCEPTION_INIT(alter_gresit,-00940);
pragma exception_init(nu_exista,-04080);
begin
execute immediate 'ALTER TRIGGER '||p_trigger_name|| ' COMPILE';
return 'the trigger was compliled';
exception 
when nu_exista then return('trigger inexistent!');
when alter_gresit then return('comanda alter trigger e gresita; verifica spatiile!');
when optiune_alter then return('nu ai trecut optinuea de compilare; verifica spatiile!');
when others then return('o alta eroare a aparut;rezolv-o!');
end manage_triggers;
end manage_triggers_package;