what is the proper way to do unsigned parameter in mysql stored procedures -


i have procedure delete user information tables in our database.

create procedure `unrollme_version3`.`del_user` (in v_user_id int(10)) begin start transaction;      delete user_table1 `user_id` = v_user_id;     delete user_table2 `user_id` = v_user_id;     delete user_table3 `user_id` = v_user_id; commit; end 

i in someway make input variable unsigned match how structure of database setup. possible , best practice.

just add word unsigned. removed (10) because it's irrelevant. describes how digits shall shown, it's int 4 bytes.

create procedure `unrollme_version3`.`del_user` (in v_user_id int unsigned) begin start transaction;      delete user_table1 `user_id` = v_user_id;     delete user_table2 `user_id` = v_user_id;     delete user_table3 `user_id` = v_user_id; commit; end 

you can force throw error instead of warning doing

set sql_mode='strict_all_tables'; 

for more information see manual.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

jquery - Invalid Assignment Left-Hand Side -

gmail - Is there any documentation for read-only access to the Google Contacts API? -