create or replace procedure sp_test(iv_y in varchar2,iv_m in varchar2)
as
v_count integer;
begin
select count(*) into v_count from table_test where year=iv_y and month=iv_m;
if v_count >0 then
Raise_Application_Error(-20001,'数据已存在!');
else
insert into table_test values (iv_y,iv_m);
commit;
end if;
end;
MySQL教程4 MySQL8运算符、函数、存储过程及新增数据类型 17.之创建带有IN和OUT参数的存储过程 学习猿地