Subversion Repositories Sigmater

Rev

Blame | Last modification | View Log | Download | RSS feed

create or replace procedure DELETE_UTENTE(user_name varchar2) is


w_cod_profilo            NUMBER;

CURSOR curruoli IS
select cod_profilo_u from WS_RUOLI  
where username = user_name;
begin

   OPEN curruoli;
   
   LOOP
       FETCH curruoli INTO w_cod_profilo;
       EXIT WHEN curruoli%NOTFOUND;
   
        delete from WS_ABILITAZIONI 
        where cod_profilo_u = w_cod_profilo;  
    
         delete from  WS_RUOLI a
         where a.cod_profilo_u = w_cod_profilo;
    
         delete from WS_PROFILI_UTENTE 
         where cod_profilo_u = w_cod_profilo;
     
   END LOOP;

   CLOSE curruoli;
   -- inserisco l'abilitazione  
   delete from ws_cross_enti_utenti   where username = user_name;
   delete from ws_utenti where username = user_name;
   commit;
     
     
exception 
          when others then
               dbms_output.put_line('ERR INS utente '|| sqlcode ||' '||sqlerrm);
               rollback;
            
end DELETE_UTENTE;
/