Bonjour,
Je cherche à faire cela :
y a t-il une manière plus élégante pour faire ceci ?Code:
1
2
3
4 and... and (mon_champ not like '%toto' or mon_champ not like '%tata' or mon_champ not like '%titi') and...
Merci
Version imprimable
Bonjour,
Je cherche à faire cela :
y a t-il une manière plus élégante pour faire ceci ?Code:
1
2
3
4 and... and (mon_champ not like '%toto' or mon_champ not like '%tata' or mon_champ not like '%titi') and...
Merci
Bonjour,
C'est assez élégant je trouve ;) en plus si tu as un index REVERSE sur mon_champ, il peut être utilisé.
Sinon une fonction REGEXP peut faire ça, mais je ne suis pas sur que ce soit plus 'élégant', et ne pourra pas utiliser d'index.
Cordialement,
Franck.
Il y a un problème de codage, parce que 2 not like avec un OR, ça ne sert à rien
toto sera <> tata donc ressortira.
Code:
1
2
3
4
5
6
7
8
9
10
11 WITH t AS (SELECT 'toto' a FROM dual UNION SELECT 'tata' FROM dual UNION SELECT 'titi' FROM dual UNION SELECT 'xxx' FROM dual) SELECT * FROM t WHERE a NOT LIKE '%toto' or a not like '%titi' A tata titi toto xxx