j'ai créé cette procédure stockée pour faire une recherche depuis un textBox avec un string qui a un format "pol/dury/".

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE'(idsociete INT, nomSociete varchar(50), dateCreSociete DATETIME, tvaSociet' at line 11

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
CREATE DEFINER = CURRENT_USER PROCEDURE `GetSociete`(
        IN SearchSociete VARCHAR(50),
        INOUT HowManyResults INTEGER
    )
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
 
BEGIN
	DECLARE societeTemp TABLE (idSociete INT, nomSociete VARCHAR(50), dateCreSociete DATETIME, tvaSociete VARCHAR(30));
	DECLARE search VARCHAR(50);
    DECLARE position INT;
    DECLARE word VARCHAR(30);
 
    /* searchSociete est une chaine reçu qui peut avoir plusieurs mots séparés par '/' 
    exemple: pol/dury/   */
 
    set search = `SearchSociete`;
    /*donne la position d'ou se trouve le caractère spécial*/
    set position = LOCATE('/', search);
 
    /*boucle tant qu'il y a ce caractère dans la chaine*/
    WHILE LOCATE('/', search) DO
 
    /*donne la position ou on se trouve avant le caractère spécial*/ 
    set position = position - 1;
    /*affecte word au mot a gauche séparé par '/' */
    set word = LEFT(search, position);
 
    /*remplit la table temporaire */
    insert into societeTemp select * from `sct`
    where nom like '%word%' or sct_num_tva like '%word%';
 
    /*donne la position ou on se trouve après le caractère spécial*
    set position = position + 2;
    /*assigne search avec la valeur de la chaine qui se trouve à droite du caractère '/' */
    set search = SUBSTRING(search, position);
 
    end while;
 
    SELECT HowManyResults = COUNT(*)FROM societeTemp;
    /* renvoie le réusltat*/
    SELECT * FROM societeTemp;
 
END;
merci de votre aide car sans ça je suis bloqué