Problem to create Database with Mysql variable

Asked

Viewed 46 times

0

I have a problem to create a database in Mysql.

The term is as follows:.

CREATE PROCEDURE trata_busca()
BEGIN
   DECLARE excessao INT default 0; <--- LINHA QUE ESTA APONTANDO PROBLEMA
   DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET excessao = 1; 
   ... 
   {500 linhas de código aqui}
   ...
END

The error message is as follows:

1064 - 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 ''

Here is the version of Mysql on the server

"innodb_version"    "5.5.39"
"protocol_version"  "10"
"slave_type_conversions"    ""
"version"   "5.5.39"
"version_comment"   "MySQL Community Server (GPL)"
"version_compile_machine"   "x86"
"version_compile_os"    "Win32"

I need to create this exception variable to use transaction. I’m using a code I saw on Devmedia to add Transaction in a process that’s functional and running in production. But when trying to add the variable’s declaration line is not working.

Any solution to this?

  • Try to declare a way: DECLARE excessao INT unsigned DEFAULT 0;

  • I tried, keep making a mistake.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.