Please I have a problem when i try to write a stored procedure on MySql,
My Procedure on SQL Server is :
//// SQL Server ///
create Proc [dbo].[P_TestSup] @para1 int, @para2 bit output as
begin
select @para2= count(IdCV) from CommandeVente,Client where
CommandeVente.IdClnCV=Client.IdCln and IdCln=@para1
End
I Try to Write it on MySQL but it's Incorrect
Error: check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
////// MySql //////
CREATE PROCEDURE P_TestSup(IN para1 INT, OUT para2 bit)
begin
select count(commandevente.idcv) into para2 from commandevente,client
where commandevente.idclncv= client.idcln and client.idcln=para1;
End
Perhaps your problem is the lack of DELIMITER
statement. And fix the JOIN
syntax. And the type of the output parameter. Also, I would be careful about naming.
Something like this:
DELIMITER $$
CREATE PROCEDURE P_TestSup(
in_para1 INT,
OUT out_para2 INT
)
BEGIN
SELECT count(commandevente.idcv) into out_para2
FROM commandevente ce
client c
ON ce.idclncv = c.idcln ;
END;$$
DELIMITER ;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.