怎么修改下面这个存储过程 create proc p_chk
(n1 int,
n2 int,
out ifCanInsert int
)
if exists(select 1 from t where n1 between number1 and number2 or
n2 between number1 and number2 )
set ifCanInsert =0
else
set ifCanInsert =1
//出现错误为
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'proc
p_chk
(n1 int,
n2 int,
out ifCanInsert int
)
if exists(select 1 from t wher' at line 1
(n1 int,
n2 int,
out ifCanInsert int
)
if exists(select 1 from t where n1 between number1 and number2 or
n2 between number1 and number2 )
set ifCanInsert =0
else
set ifCanInsert =1
//出现错误为
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'proc
p_chk
(n1 int,
n2 int,
out ifCanInsert int
)
if exists(select 1 from t wher' at line 1
create proc p_chk (n1 int, n2 int, out ifCanInsert int)
begin
if exists(select 1 from t where n1 between number1 and number2 or
n2 between number1 and number2 ) then
set ifCanInsert =0;
else
set ifCanInsert =1;
end if;
enddelimiter ;
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `zz`.`ee`(n1 int,
n2 int,
out ifCanInsert int )
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
if (select count(*) from t where n1 between number1 and number2 or
n2 between number1 and number2)>0 then
set ifCanInsert =0;
else
set ifCanInsert =1 ;
end if;
END$$DELIMITER ;orDELIMITER $$CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `zz`.`ee`(n1 int,
n2 int,
out ifCanInsert int )
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
if exists(select 1 from t where n1 between number1 and number2 or
n2 between number1 and number2 ) then
set ifCanInsert =0;
else
set ifCanInsert =1 ;
end if;
END$$DELIMITER ;