我尝试在 ibatis 迁移脚本中使用Big DBA Head的以下示例。
delimiter //
drop function if exists true_function //
create function true_function(p_param int) returns int
deterministic
sql security invoker
return true
//
drop function if exists get_next_value//
create function get_next_value(p_name varchar(30)) returns int
deterministic
sql security invoker
begin
declare current_val integer;
update mysql.sequences
set value = value + 1
where name = p_name
and true_function((@current_val := mysql.sequences.value) is not null);
return @current_val;
end//
delimiter ;
但是ibatis会抛出这个错误:
...执行错误:分隔符 // 如果存在则删除函数 get_next_value_test // 创建函数 get_next_value_test(p_name varchar(30)) 返回 int 确定性 sql 安全调用程序开始
声明 current_val 整数。原因:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 'delimiter //... 附近使用的正确语法
我已经尝试设置 allowMultiQueries 和 send_full_script 但没有成功。你有什么想法让这个脚本执行吗?
谢谢,T。