MySQL Forums
Forum List  »  French

Error Code: 1064. 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
Posted by: Oumar TOURE
Date: April 09, 2017 01:23AM

Bonours,
J'ai l'erreur suivante qui survient lorsque j'appelle cette procedure:

Error Code: 1064. 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 'CALL demandeur_Insert('CAMARA','Mohamed','HOMME','664410235','Ingenieur','AREDOR' at line 3


CREATE DEFINER=`root`@`localhost` PROCEDURE `demandeur_Insert`(Nom varchar(45),prenom varchar(45),sexe varchar(10),Telephone varchar(45),profession varchar(45),lieuTravail varchar(45),adresse varchar(45),commune varchar(45),quartier varchar(45),creationUserId INT)
BEGIN
INSERT INTO `gesparc`.`demandeur`(
`id`,
`Nom`,
`prenom`,
`code`,
`sexe`,
`Telephone`,
`profession`,
`lieuTravail`,
`adresse`,
`commune`,
`quartier`,
`creationDate`,
`creationUserId`,
`lastModifdate`,
`lastmodifUserId`
)
SELECT
NULL AS id,
Nom,
prenom,
CONCAT(t.prefixe,t.annee,t.mois,t.jours,
LPAD(IF(t.datePrecedente != t.dateCourante,0, t.numero + 1), 4, '0')
) as nouveau_code,
sexe,
Telephone,
profession,
lieuTravail,
adresse,
commune,
quartier,
CURRENT_TIMESTAMP,
creationUserId,
CURRENT_TIMESTAMP,
creationUserId
FROM(
SELECT
code,
MID(code, 1, 1) AS prefixe,
MID(code, 2, 4) AS lastAnnee,
MID(code, 6, 2) AS lastMois,
MID(code, 8, 2) AS lastJours,
MID(CURRENT_TIMESTAMP, 1, 4) AS annee,
MID(CURRENT_TIMESTAMP, 6, 2) AS mois,
MID(CURRENT_TIMESTAMP, 9, 2) AS jours,
MID(code, 10, 4) AS numero,
CURRENT_DATE as dateCourante,
concat(MID(code, 2, 4),'-',MID(code, 6, 2),'-',MID(code, 8, 2)) as datePrecedente
FROM demandeur
ORDER BY code DESC
LIMIT 1
) as t;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Error Code: 1064. 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
14162
April 09, 2017 01:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.