| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 
 | create or replace procedure Crediter_Argent(p_montant in credit.montant_total%type,p_taux in credit.taux_intr%type,p_duree credit.duree_remb%type,p_type in credit.cr_type%type,p_rib compte.rib%type)
 
is
 
test_val boolean;
p_date Date;
v_nb number;
p_crid credit.cr_id%type;
p_montant_mensuel credit.mentant_mensuel%type;
credit_non_valide exception;
 
begin
 
test_val:=Test_Validite_Credit(p_montant,p_taux,p_duree,p_rib,p_montant_mensuel);
 
if(test_val)
then
 
Deposer_Argent(p_montant,p_rib);
dbms_output.put_line('le credit a été versé dans le compte');
select count(*) into v_nb from credit where rib=p_rib;
p_crid:=v_nb+1;
p_date:=sysdate();
insert into credit(cr_id,montant_total,taux_intr,duree_remb,cr_date,cr_type,rib,montant_mensuel) values (p_crid,p_montant,p_taux,p_duree,p_date,p_type,p_rib,p_montant_mensuel);
dbms_output.put_line('credit sauvegarde');
 
else
raise credit_non_valide;
end if;
 
exception
when credit_non_valide then raise_application_error(-20001,'credit_non_valide ');
end Crediter_Argent; | 
Partager