|
Hi everybody,
I've a problem loading procedure store in phpMyAdmin ..
i've used wamp server ver. 5.0.1
I've tried to use "import " for loading the whole function.. there is a error message " error of syntax.."
then i've tried with sql for loading each function....there is a error message " #1064...error of syntax.."
please help
here is my procedure
--
-- database: `formation`
--
DELIMITER $$
CREATE FUNCTION `ajoutinscription`(idparticipant int, seance int, idstatut int, v_ret int) RETURNS int(11) deterministic
begin
declare v_count int;
declare v_place int;
declare continue handler for sqlstate '23000' set v_ret = -2;
set v_ret=-1;
select count(*) into v_count from inscription i where i.idparticipant =idparticipant and i.idseance=seance;
if v_count =0 then
--start transaction;
--update seance set nbplaces =nbplaces -1 where idseance=seance;
--insert into inscription values (null, idparticipant,seance,idstatut);
select nbplaces into v_place from seance where idseance=seance;
if v_place >= 1 and v_ret =-1 then
update seance set nbplaces =nbplaces -1 where idseance=seance;
insert into inscription values (null, idparticipant,seance,idstatut);
--commit;
set v_ret=last_insert_id();
--else
--rollback;
end if;
end if;
return v_ret;
end$$
DELIMITER ;
|