bonjour,
j'ai par exemple cette champ :mon objectif est de prendre les trois caractères aprés le 'sur '.
Code : Sélectionner tout - Visualiser dans une fenêtre à part Pb de HSPA Rab setup sur SFX4149F11 depuis 18/11
j'ai essayé avec cet fonction. Mais, dans le résultat il s'affiche vide.
merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 delimiter | CREATE FUNCTION METTRE(s VARCHAR(2000)) RETURNS varchar(2000) DETERMINISTIC BEGIN DECLARE open INT; DECLARE close INT; DECLARE someLimit INT; DECLARE str VARCHAR(2000); DECLARE toFind VARCHAR(2000); DECLARE nom VARCHAR(20000); SET open = 1; SET close = 1; SET toFind = s ; SET someLimit = 100; SET str =''; WHILE close > 0 and open > 0 and someLimit > 0 DO SET someLimit = someLimit -1; SET open = locate('sur',toFind); IF open > 0 THEN SET toFind = SUBSTRING(toFind,open); SET close = locate(4,toFind); IF close > 2 THEN SET nom=SUBSTRING(toFind,2,close-2); SET toFind = SUBSTRING(toFind,close); END IF; END IF; END WHILE; return SUBSTRING(str,2); END | delimiter;
Partager