stored procedure problem in Mysql
-
Hi, iam using MySql db, my stored procedure is like this.. DELIMITER $$ DROP PROCEDURE IF EXISTS `test`.`IS_CITY_EXISTS` $$ CREATE PROCEDURE `IS_CITY_EXISTS`( IN CITYNAME VARCHAR(45), OUT AVAILABLE BOOLEAN ) BEGIN IF EXISTS(SELECT * FROM city_details WHERE city_name=CITYNAME) THEN SELECT 1 INTO AVAILABLE; ELSE SELECT 0 INTO AVAILABLE; END IF; END $$ DELIMITER ; when iam executing this procedure works fine.. CALL IS_CITY_EXISTS('kak',@Available); but while exceuting SELECT @AVAILABLE;--IT'S giving result null. is there any error in procedure.. how can i call this procedure in (c#)..
murali krishna
-
Hi, iam using MySql db, my stored procedure is like this.. DELIMITER $$ DROP PROCEDURE IF EXISTS `test`.`IS_CITY_EXISTS` $$ CREATE PROCEDURE `IS_CITY_EXISTS`( IN CITYNAME VARCHAR(45), OUT AVAILABLE BOOLEAN ) BEGIN IF EXISTS(SELECT * FROM city_details WHERE city_name=CITYNAME) THEN SELECT 1 INTO AVAILABLE; ELSE SELECT 0 INTO AVAILABLE; END IF; END $$ DELIMITER ; when iam executing this procedure works fine.. CALL IS_CITY_EXISTS('kak',@Available); but while exceuting SELECT @AVAILABLE;--IT'S giving result null. is there any error in procedure.. how can i call this procedure in (c#)..
murali krishna
I've never used MySQL but two observations still: - you set delimiter to $$. However you use semicolon after the statements. - is 0 equal to false in mysql or does it understand false keyword. If so, 0 may be interpreted to null since it's not false. But then again, just guessing.
The need to optimize rises from a bad design. My articles[^]