mysql - 是否可以在存储过程中为参数数据类型传入 auto_increment?
问题描述
创建过程 add_fighter( 在 p_fighter_id int auto_increment , 在 p_fighter_name varchar(50) , 在 p_country_of_origin varchar(2) , 在 p_fighter_age int , 在 p_UFC_debut int ) 开始声明混乱 varchar(70);
-- check if fighter_id is empty
if p_fighter_id = '' then
set mess = 'please enter the fighter_id';
end if;
-- check if fighter_name is empty
if p_fighter_name = '' then
set mess = 'please enter the figher_name';
end if;
if p_country_of_origin = '' then
set mess = 'please enter the fighter''''s country_of_origin';
end if;
if p_fighter_age = '' then
set mess = 'please enter the fighter''s'' age';
end if;
if p_UFC_debut = '' then
set mess = 'please enter the fighter''''s UFC_debut year';
end if;
if p_fighter_name not like '% %' then
set mess = 'please enter the fighter''''s full name';
end if;
if counrty_of_origin not like '%__%' then
set mess = 'please use the 2 letter abbreviation of the country';
end if;
insert into fighters(
fighter_id
,fighter_name
,country_of_origin
,fighter_age
,UFC_debut
)
values(
p_fighter_id
,p_fighter_name
,p_country_of_origin
,p_fighter_age
,p_UFC_debut
);
解决方案
推荐阅读
- clojure - 使用 Spectre 从动态索引中选择向量元素
- mongodb - 如何删除 mongo db 中的推文链接
- ubuntu - 无法全局安装电子
- r - 具有 dplyr 的自定义函数在一个因子内针对不同级别进行变异或汇总?
- ios - 选择 DatePicker 后更新单元格中的日期(时间)
- java - 片段中的回收站视图为空
- c++ - 为什么 const char* const & = "hello" 可以编译?
- c# - 在c#中返回元组字典作为函数的返回类型
- angular - 如何正确实施“photo.service”?
- javascript - 锚标签-在 iphone7/6s plus 中没有在 mousedown 上获取日志