I am trying to make a stored procedure using mySQL. This procedure will validate a username and a password. I'm currently running mySQL 5.0.32 so it should be possible to create procedures.
Heres the code I've used. All I get is an SQL syntax error.
GO CREATE PROCEDURE checkUser (IN @brugernavn varchar(64)),IN @password varchar(64)) BEGIN SELECT COUNT(*) FROM bruger WHERE bruger.brugernavn=@brugernavn AND bruger.pass=@Password; END;
Thank you in advance
To pass one or more arguments to a procedure In the calling statement, follow the procedure name with parentheses. Inside the parentheses, put an argument list. Include an argument for each required parameter the procedure defines, and separate the arguments with commas.
Parameters are used to exchange data between stored procedures and functions and the application or tool that called the stored procedure or function: Input parameters allow the caller to pass a data value to the stored procedure or function.
I figured it out now. Here's the correct answer
CREATE PROCEDURE checkUser ( brugernavn1 varchar(64), password varchar(64) ) BEGIN SELECT COUNT(*) FROM bruger WHERE bruger.brugernavn=brugernavn1 AND bruger.pass=password; END;
@ points to a global var in mysql. The above syntax is correct.
(IN @brugernavn varchar(64)**)**,IN @password varchar(64))
The problem is the )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With