Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to call a storedprocedure in MySql Query browser ??

Posted on 2009-05-18
2
Medium Priority
?
4,155 Views
Last Modified: 2012-05-07
Hi experts,

 I have written the below sp in MySql..

 when i execute the sp by passing parameters like this...
 call sp_LoginCheck ('srk1','pwd');

I am getting error :

Error Code : 1318
Incorrect number of arguments for PROCEDURE demo.sp_LoginCheck; expected 3, got 2
(0 ms taken)

Which is wiered because, there are only 2 input parameters.
Am i missing something ?

Thanks.
DELIMITER $$
 
DROP PROCEDURE IF EXISTS `demo`.`sp_LoginCheck`$$
 
create PROCEDURE `demo`.`sp_LoginCheck`( 
 IN UserName1 varchar(50),
 IN Password1 varchar(50),
 OUT DoesExist bit)   
    BEGIN
 declare userCount INT default 0;
 SET DoesExist = 0; -- set to false initially, we'll assume for now it doesn't exist
 SELECT COUNT(Uid) INTO userCount
 FROM tbl_Users
 WHERE username = username1 and password=password1;
 IF userCount > 0 THEN
  SET DoesExist = 1;  -- more then one returned, return true
 END IF;
    END$$
 
DELIMITER ;

Open in new window

0
Comment
Question by:srk1982
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
DABOMB earned 1000 total points
ID: 24419187
You will notice that there are 3 parameters to the function call, you have the first 2 correct as they are inputs, but you must pass a variable to capture the output.

call sp_LoginCheck ('srk1','pwd',@MYVAR);

then you can use

SELECT @MYVAR\G

which would return DoesExist (0 or 1)
0
 

Author Closing Comment

by:srk1982
ID: 31582848
Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question