【 使用环境 】社区版测试环境
【 OB】
【 使用版本 】4.2.5.2
【问题描述】
create event test
on schedule every 1 DAY starts ‘2018-11-20 06:00:00’
ON COMPLETION PRESERVE
do
begin
call proc_name();
end
报错:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘call’ at line 6
这样跑呢,可能是解析分号错了
DELIMITER $$
CREATE EVENT test
ON SCHEDULE EVERY 1 DAY
STARTS ‘2018-11-20 06:00:00’
ON COMPLETION PRESERVE
DO
BEGIN
CALL proc_name();
END $$
DELIMITER ;
还是报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘CALL’ at line 6
看着你执行的语法有误 貌似没有begin end 这个块
create event test
on schedule every 1 DAY starts ‘2018-11-20 06:00:00’
ON COMPLETION PRESERVE
do
call proc_name();
单独执行CALL proc_name();
或单独执行CREATE EVENT test
ON SCHEDULE EVERY 1 DAY STARTS ‘2018-11-20 06:00:00’
ON COMPLETION PRESERVE
DO
BEGIN
…
END 都正常,加起来就报错,这个版本还是不支持吗?
我没有理解你说的 这样执行报错么?截图看看
create event test
on schedule every 1 DAY starts ‘2018-11-20 06:00:00’
ON COMPLETION PRESERVE
do
call proc_name();
这个报错 是单引号转义了 导致的 你粘贴过去注意 字符转义
哦,执行成功了,不能用bigin…end,那有多条语句的怎么改?
create event test
on schedule every 1 DAY starts ‘2018-11-20 00:00:00’
ON COMPLETION PRESERVE
do
begin
start transaction;
call proc_name();
commit;
end
我记得 mysql也是不能吧 我看你不是用存储过程了么?存储过程 不就是可以执行多条语句么?