Does anybody knowns why this code work throught command line with mysql.exe, but it doesn't work throught ODBC connection:
create procedure executa_comando (IN p_comando text,
OUT p_cod_erro varchar(5),
OUT p_msg_erro varchar(255),
OUT p_qtde_regs int)
begin
declare erro text;
declare exit handler for sqlexception
begin
get diagnostics condition 1 erro = message_text, p_cod_erro = returned_sqlstate;
set p_msg_erro = cast(replace(erro, '''', '''''') as char(255));
end;
set p_cod_erro = '00000';
set p_msg_erro = '';
set @cmd = p_comando;
prepare stmt from @cmd;
execute stmt;
select row_count() into p_qtde_regs;
deallocate prepare stmt;
end;
The error appears to be in the exit handler group.
Thanks in advance.
create procedure executa_comando (IN p_comando text,
OUT p_cod_erro varchar(5),
OUT p_msg_erro varchar(255),
OUT p_qtde_regs int)
begin
declare erro text;
declare exit handler for sqlexception
begin
get diagnostics condition 1 erro = message_text, p_cod_erro = returned_sqlstate;
set p_msg_erro = cast(replace(erro, '''', '''''') as char(255));
end;
set p_cod_erro = '00000';
set p_msg_erro = '';
set @cmd = p_comando;
prepare stmt from @cmd;
execute stmt;
select row_count() into p_qtde_regs;
deallocate prepare stmt;
end;
The error appears to be in the exit handler group.
Thanks in advance.