-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACTIONSURCOMPTE.sql
102 lines (72 loc) · 2.52 KB
/
ACTIONSURCOMPTE.sql
1
2
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
REM ***************************************************************************
REM APPLICATION BANCAIRE - PROCEDURES
REM Auteur : HAUTEFEUILLE Eliot
REM Date de Mise à Jour : 01/06/2015
REM ***************************************************************************
PROMPT -- APPLICATION BANCAIRE - PROCEDURES - Eliot Hautefeuille
REM ************************************************
PROMPT -- (PROC) ajoutNouvOperation(idCompte, montant)
create or replace procedure ajoutNouvOperation (idc integer, val number) is
begin
insert into operation(idOperation, idCompte, montantOperation)
values(seq_operation.nextval, idc, val);
end ;
/
REM ************************************************
PROMPT -- (PROC) annulerOperation(idOperation)
create or replace procedure annulerOperation (ido integer)
is
val number(10,2) ;
idc integer ;
begin
select idCompte, montantOperation into idc, val
from operation where idOperation = ido ;
insert into operation(idOperation, idCompte, montantOperation)
values(seq_operation.nextval, idc, -val);
end ;
/
REM ************************************************
PROMPT -- (PROC) majDecouvertAutorise(idCompte, value)
create or replace procedure majDecouvertAutorise (idc integer, val number) is
begin
update compte set decouvertAutorise = val where idCompte = idc ;
end ;
/
REM ************************************************
PROMPT -- (PROC) majMontantOperation(idOperation, value)
create or replace procedure majMontantOperation (ido integer, val number) is
begin
update operation set montantOperation = val where idOperation = ido ;
end ;
/
REM ************************************************
PROMPT -- (PROC) faireTransfertCompte(ori, dest, value)
create or replace procedure majMontantOperation (
ori integer, dest integer, val number) is
begin
ajoutNouvOperation(ori, -val);
ajoutNouvOperation(dest, val);
end ;
/
REM ************************************************
PROMPT -- (PROC) banqueOperation(idOperation) : varchar
create or replace function banqueOperation (ido integer) return varchar
is
nom varchar(50) ;
begin
select libelleBanque into nom from Banque b, Compte c, Operation o
where b.idBanque = c.idBanque and c.idCompte = o.idCompte
and o.idOperation = ido ;
return nom ;
end ;
/
REM ************************************************
PROMPT -- (PROC) soldeCompte(idCompte) : number
create or replace function soldeCompte (idc integer) return number
is
solde number(10,2) ;
begin
select soldeCompte into solde from Compte where idCompte = idc ;
return solde ;
end ;
/