Disallow NULL parameters to stored procedures in MySQL/MariaDB -


i can specify table columns not null, how make stored procedure or function compatible non-null arguments? adding not null after argument name doesn't work.

you need validate passed parameter values yourself. if you're using mysql 5.5 , can make use of signal.

delimiter // create procedure my_procedure (in param1 int) begin   if param1 null     signal sqlstate '45000' set message_text = 'null not allowed.';   end if;   -- whatever  end// delimiter ; 

here sqlfiddle demo


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -