corr_table_5a1.sql
-----------------------------------------------------------------------------------
drop table archive;
create table archive(ids int, idc int, idv int, jour int, avoir int);
select * from archive;

create or replace trigger archivage
    after delete
    on sejour
    for each row
declare 
    l_avoir client.avoir%type;
begin
    select avoir
        into l_avoir
        from client
	where idc = :old.idc;
    insert into archive values(
        :old.ids, :old.idc, :old.idv, :old.jour, l_avoir);
    dbms_output.put_line(
        :old.ids||', '||:old.idc||', '||:old.idv||', '||:old.jour||', '||l_avoir);
end;
/
-- test :
delete sejour where jour < 362;

-----------------------------------------------------------------------------------
