You have an error in your SQL syntax; check the manual that cor

Fermé
fattahh Messages postés 1 Date d'inscription dimanche 10 février 2013 Statut Membre Dernière intervention 10 février 2013 - 10 févr. 2013 à 17:23
arth Messages postés 9374 Date d'inscription mardi 27 septembre 2005 Statut Contributeur Dernière intervention 16 décembre 2016 - 11 févr. 2013 à 00:27
bonsoir, je cherche aussi la petite chose qui ne va pas dans ma ligne et qui me vaut ce message:

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 'DELIMITER |' at line 1

Le code est le suivant:

DELIMITER |
CREATE FUNCTION CalculPrixTTC (p_price DECIMAL(10,2), p_tax DECIMAL(10,2)) RETURNS DECIMAL(10,2) DETERMINISTIC BEGIN RETURN ROUND(((p_price / 100) * p_tax), 2) + p_price; END |
CREATE PROCEDURE CleanBasketTable() DETERMINISTIC BEGIN DELETE FROM Basket WHERE DateAdded < DATE_SUB(NOW(), INTERVAL 1 DAY); END |
CREATE PROCEDURE CleanCustomerTable(IN p_nb_day INT) DETERMINISTIC BEGIN DECLARE v_id_customer INT(9) DEFAULT 0; DECLARE v_date_now TIMESTAMP; DECLARE v_date_connect TIMESTAMP; DECLARE c_end_cursor BOOLEAN DEFAULT FALSE; DECLARE c_nb_id_customer CURSOR FOR SELECT cus.ID_Customer, MAX(DateLastVisit) FROM Customer AS cus LEFT JOIN Orders AS odr ON odr.ID_Customer = cus.ID_Customer WHERE odr.ID_Customer IS NULL AND DateLastVisit != "0000-00-00 00:00:00" GROUP BY cus.ID_Customer; DECLARE CONTINUE HANDLER FOR NOT FOUND SET c_end_cursor = TRUE; DELETE FROM Customer WHERE Status = "T" AND DateAdded < DATE_SUB(NOW(), INTERVAL 1 DAY); SELECT DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL p_nb_day DAY) INTO v_date_now; OPEN c_nb_id_customer; FETCH c_nb_id_customer INTO v_id_customer, v_date_connect; WHILE (NOT c_end_cursor) DO IF (v_date_connect < v_date_now) THEN DELETE FROM Customer WHERE ID_Customer = v_id_customer; END IF; FETCH c_nb_id_customer INTO v_id_customer, v_date_connect; END WHILE; CLOSE c_nb_id_customer; END |

je vous remercie pour votre aide
FAttah

1 réponse

arth Messages postés 9374 Date d'inscription mardi 27 septembre 2005 Statut Contributeur Dernière intervention 16 décembre 2016 1 291
11 févr. 2013 à 00:27
Si je m'en réfère à cette doc :

http://dev.mysql.com/doc/refman/5.0/fr/create-procedure.html

J'ai l'impression que le problème vient du END suivi de |, alors que selon cette doc le | se met dans une nouvelle ligne après le END.
0