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
| SQL> var Maligne varchar2(10);
SQL> exec :Maligne := 'A';
Procedure PL/SQL terminee avec succes.
SQL> with t as (
select 'A1' as uniteProd from dual union all
select 'A2' as uniteProd from dual union all
select 'A5' as uniteProd from dual union all
select 'B2' as uniteProd from dual union all
select 'B10' as uniteProd from dual union all
select 'C1' as uniteProd from dual union all
select 'C2' as uniteProd from dual union all
select 'C5' as uniteProd from dual union all
select 'G4' as uniteProd from dual union all
select 'G45' as uniteProd from dual
)
select *
from t
where CASE WHEN :MaLigne = 'A' and uniteProd IN ('A1', 'A2', 'A5')
then 1
WHEN :MaLigne = 'B' and uniteProd IN ('B2', 'B10')
then 1
WHEN :MaLigne = 'C' and uniteProd IN ('C1', 'C2', 'C5')
then 1
WHEN :MaLigne = 'G' and uniteProd IN ('G4', 'G45')
then 1
WHEN :MaLigne = 'Toutes' and uniteProd IN ('A1', 'A2', 'A5', 'B2', 'B10', 'C1', 'C2', 'C5', 'G4', 'G45')
then 1
END = 1;
UNI
---
A1
A2
A5
SQL> exec :Maligne := 'G';
Procedure PL/SQL terminee avec succes.
SQL> /
UNI
---
G4
G45
SQL> exec :Maligne := 'Toutes';
Procedure PL/SQL terminee avec succes.
SQL> /
UNI
---
A1
A2
A5
B2
B10
C1
C2
C5
G4
G45
10 ligne(s) selectionnee(s).
SQL> |
Partager