Pls...I can't understand what s the problem in this procedure..
-
Hi Everyone, I used the below stored procedure to delete a single record in a table in MySql. Procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `healthtour`.`USP_User_DeleteUserRole`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `USP_User_DeleteUserRole` ( IN UserRoleID INT ) BEGIN DELETE FROM HT_UserRole WHERE UserRoleID = UserRoleID; END$$ DELIMITER ; Problem: I run this procedure as below, CALL USP_User_DeleteUserRole(2); I have the records in my table for the UserRoleID 10. And i don't have the records for the UserRoleID 2. If I give the input(UserRoleID 2) then the record 10 is deleted. It should not be deleted. Because i gave the input 2 and not 10. Please can anybody help me?. Thanks, -Periyasamy Ramachandiran
-
Hi Everyone, I used the below stored procedure to delete a single record in a table in MySql. Procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `healthtour`.`USP_User_DeleteUserRole`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `USP_User_DeleteUserRole` ( IN UserRoleID INT ) BEGIN DELETE FROM HT_UserRole WHERE UserRoleID = UserRoleID; END$$ DELIMITER ; Problem: I run this procedure as below, CALL USP_User_DeleteUserRole(2); I have the records in my table for the UserRoleID 10. And i don't have the records for the UserRoleID 2. If I give the input(UserRoleID 2) then the record 10 is deleted. It should not be deleted. Because i gave the input 2 and not 10. Please can anybody help me?. Thanks, -Periyasamy Ramachandiran
It looks like you need to read up on what to do when a parameter name is the same as the name of a column in one of the tables (which obviously sounds dangerous). For example, http://stackoverflow.com/questions/715229/mysql-stored-procedures-parameter-with-the-same-name-as-affectings-column-is-i[^] Scott
-
It looks like you need to read up on what to do when a parameter name is the same as the name of a column in one of the tables (which obviously sounds dangerous). For example, http://stackoverflow.com/questions/715229/mysql-stored-procedures-parameter-with-the-same-name-as-affectings-column-is-i[^] Scott
Hi, Yes I found the error that i have used the same name for both table column name and the variable name. Just i changed the variable name. Now it works fine. Thank u very much. -Periyasamy Ramachandiran.