Answered by:
store procedure in mysql

Question
-
User639567535 posted
i try to create procedure in mysql but it shows me error
Delimiter // CREATE PROCEDURE sp_login() BEGIN Select * from login where UName=@Uname and UPasword ; END //
error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. ERROR: Unknown Punctuation String @ 93 STR: // SQL: CREATE PROCEDURE sp_login() BEGIN Select * from login where UName=@Uname and UPasword ; END // SQL query: Documentation CREATE PROCEDURE sp_login() BEGIN Select * from login where UName=@Uname and UPasword ; END // MySQL said: Documentation #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 '//' at line 4
help?
Tuesday, September 16, 2014 4:43 AM
Answers
-
User1508394307 posted
but it shows me ERROR
where is the mistake
Your query is correct but it might depends on where you call it.
See demo: http://sqlfiddle.com/#!2/1d37d/1
Read about the DELIMITER command http://rpbouman.blogspot.de/2008/02/most-misunderstood-character-in-mysqls.html
Some other useful tutorial: http://www.mysqltutorial.org/getting-started-with-mysql-stored-procedures.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 16, 2014 6:09 AM
All replies
-
User364480375 posted
As error suggest u r missing MYsql syntax..... . check your query once again..u will get your ans
Tuesday, September 16, 2014 5:10 AM -
User639567535 posted
ok now i try this with paramters
DELIMITER //
Create procedure spselectusertype
(
UName varchar(50),
Pasword varchar(50)
);
begin
Select LTID FROM login
WHERE UName = UName AND UPasword = Pasword;
DELIMITER ;but it shows me ERROR
where is the mistake
Tuesday, September 16, 2014 5:22 AM -
User-1806150748 posted
can you try following!
DELIMITER // Create procedure `spselectusertype` ( in UName varchar(50) , in Pasword varchar(50) ); begin Select LTID FROM login WHERE UName = UName AND UPasword = Pasword; DELIMITER ;
Tuesday, September 16, 2014 5:30 AM -
User1508394307 posted
but it shows me ERROR
where is the mistake
Your query is correct but it might depends on where you call it.
See demo: http://sqlfiddle.com/#!2/1d37d/1
Read about the DELIMITER command http://rpbouman.blogspot.de/2008/02/most-misunderstood-character-in-mysqls.html
Some other useful tutorial: http://www.mysqltutorial.org/getting-started-with-mysql-stored-procedures.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 16, 2014 6:09 AM