title: Error in the MYSQL procedure with Quote (Prepared Statement)
body: <p>I don't know much about MYSQL and I'm trying to convert a procedure from pgsql to mysql, however it's claiming that I have this error: &quot;You have a syntax error in your SQL next to ''. I've redone it, but it continues giving this error, can anyone help?</p>
  <p>This is the MYSQL procedure that is giving an error:</p>
  <pre><code>CREATE PROCEDURE cadastro_cliente(IN _cpf VARCHAR(20), IN _nome TEXT, IN _data_nasc DATE,
              IN _telefone VARCHAR(20), IN _email VARCHAR(100), IN _senha VARCHAR(12),
              IN _endereco TEXT, IN _cep VARCHAR(20), IN _cidade VARCHAR(50), IN _estado CHAR(2), IN _caminho_foto_perfil TEXT)
  BEGIN    
  SET @query = CONCAT(&quot;INSERT INTO cliente (cpf, nome, data_nasc,telefone, email, senha, endereco, cep, cidade, estado, caminho_foto_perfil) VALUES (&quot;, QUOTE(_cpf),&quot;,&quot;, QUOTE(_nome),&quot;,&quot;, QUOTE(_data_nasc),&quot;,&quot;, QUOTE(_telefone),&quot;,&quot;, QUOTE(_email),&quot;,&quot;, QUOTE(_senha),&quot;,&quot;, QUOTE(_endereco),&quot;,&quot;, QUOTE(_cep),&quot;,&quot;, QUOTE(_cidade),&quot;,&quot;, QUOTE(_estado),&quot;,&quot;, QUOTE(_esta_caminho_foto_perfildo),&quot;);&quot;);
  PREPARE stmt FROM @query;
  EXECUTE stmt;
  DEALLOCATE PREPARE stmt;
  SET @query = NULL;
  END;
  </code></pre>
  <p>This is the PGSQL procedure I want to do:</p>
  <pre><code>CREATE or replace FUNCTION 
  cadastro_cliente(_cpf VARCHAR, _nome VARCHAR, _data_nasc DATE,
                  _telefone VARCHAR, _email VARCHAR, _senha VARCHAR,
                  _endereco TEXT, _cep VARCHAR, _estado CHAR)
  RETURNS void AS $$
  
  DECLARE
      dt_cadastro DATE := (SELECT now()::timestamp(0));
      last_login DATE := (SELECT now()::timestamp(0));
      update_reg DATE := (SELECT now()::timestamp(0));
  
  BEGIN
      EXECUTE 'INSERT INTO cliente VALUES (quote_ident($1),
      quote_ident($2),$9 ,quote_ident($3),
      quote_ident($4),quote_ident($5),$10 ,
      $11 ,$12 ,quote_ident($6),
      quote_ident($7), quote_ident($8));' 
      USING _cpf, _nome, _telefone, _email, _senha,
      _endereco, _cep, _estado, _data_nasc, dt_cadastro, 
      last_login, update_reg;
  END
  $$ LANGUAGE plpgsql;
  </code></pre>