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
|
SELECT distinct numentreprise as numero,
nvl(
case
when
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code1')
and idref=10),' ')='Oui'
or
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code2')
and idref=10),' ')='Oui'
then 'organisation 1'
when
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code3')
and idref=10),' ')='Oui'
or
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code4')
and idref=10),' ')='Oui'
or
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code5')
and idref=10),' ')='Oui'
or
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code6')
and idref=10),' ')='Oui'
or
NVL((select t2.alias from tablecode t2
where t2.valeur=fonction(id,sysdate, 'code7')
and idref=10),' ')='Oui'
then 'organisation 2'
end,'-') "Organisation"
FROM tablepersonne ta
........................
where ta.numero = 123456 |
Partager