I have a procedure to delete a user information from all the tables in our database.
CREATE PROCEDURE `unrollme_version3`.`del_user` (in v_user_id int(10))
BEGIN
START TRANSACTION;
DELETE FROM user_table1 WHERE `user_id` = v_user_id;
DELETE FROM user_table2 WHERE `user_id` = v_user_id;
DELETE FROM user_table3 WHERE `user_id` = v_user_id;
COMMIT;
END
i would like to in someway make the input variable only unsigned to match how the structure of the database is setup. is this possible and what is the best practice.
Just add the word
unsigned. I removed the(10)just because it’s irrelevant. It just describes how much digits shall be shown, but it’s always an int with 4 bytes.You can force to throw an error instead of a warning by doing
For more information see the manual.