Error Code: 1064 - Mysql

Asked

Viewed 13,698 times

0

Hello, everybody!

When building a simple inclusion process gave this following message!

Error Code: 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 'natural, naciona, profiss, nac_res, cpf_res, cin_res, est_civ, data_mat, ' at line 89

The Warning gives precisely the variable natural

Follow my SP code:

CREATE PROCEDURE sp_IncluirDadosAluno(
    m_j_codcli char(5) ,
    m_j_nome char(45),
    m_cind char(10),
    m_oexp char(15),
    m_cpff char(14),
    m_sexo char(1) ,
    m_natural char(25),
    m_naciona char(25),
    m_profiss char(25),
    m_nac_res char(25),
    m_cpf_res char(14),
    m_cin_res char(10),
    m_est_civ char(25),
    m_data_mat char(10),
    m_data_nas char(10),
    m_pai char(45),
    m_mae char(45),
    m_data_nap char(10),
    m_data_nam char(10),
    m_endereco char(100),
    m_cidade char(35),
    m_bairro char(35),
    m_estado char(2) ,
    m_cep char(10),
    m_telefone char(14),
    m_telefon1 char(14),
    m_email char(45),
    m_j_curso char(3) ,
    m_j_serie char(3) ,
    m_j_areas char(3) ,
    m_ncurso char(35),
    m_nserie char(35),
    m_nareas char(35),
    m_j_turma char(10),
    m_j_turno char(1) ,
    m_j_sala char(5) ,
    m_j_situ char(1) ,
    m_j_bols char(1) ,
    m_descto double(10,2),
    m_foto char(30),
    m_J_CONV char(3) ,
    m_NCONVE char(30),
    m_MATRCONV char(12),
    m_MATRREAL char(22),
    m_numero char(5) ,
    m_ecivil char(12),
    m_certnasc char(25),
    m_ota char(1) ,
    m_lestrang char(20),
    m_nac_mae char(25),
    m_civil_mae char(12),
    m_profis_mae char(30),
    m_cracha_mae char(25),
    m_cpf_mae char(14),
    m_ci_mae char(10),
    m_cracha_pai char(25),
    m_naci_mae char(25),
    m_estac_mae char(12),
    m_rf char(1) ,
    m_nom_f char(45),
    m_pro_f char(30),
    m_cpf_f char(14),
    m_ci_f char(10),
    m_eci_f char(12),
    m_nac_f char(25),
    m_dna_f char(10),
    m_cra_f char(25),
    m_rped char(1) ,
    m_nom_ped char(45),
    m_pro_ped char(30),
    m_cpf_ped char(14),
    m_ci_ped char(10),
    m_eci_ped char(12),
    m_nac_ped char(25),
    m_dna_ped char(10),
    m_cra_ped char(25)  
)

BEGIN

INSERT INTO l01j14
(
    j_codcli,
    j_nome,
    cind,
    oexp,
    cpff,
    sexo,
    natural,
    naciona,
    profiss,
    nac_res,
    cpf_res,
    cin_res,
    est_civ,
    data_mat,
    data_nas,
    pai,
    mae,
    data_nap,
    data_nam,
    endereco,
    cidade,
    bairro,
    estado,
    cep,
    telefone,
    telefon1,
    email,
    j_curso,
    j_serie,
    j_areas,
    ncurso,
    nserie,
    nareas,
    j_turma,
    j_turno,
    j_sala,
    j_situ,
    j_bols,
    descto,
    foto,
    J_CONV,
    NCONVE,
    MATRCONV,
    MATRREAL,
    numero,
    ecivil,
    certnasc,
    ota,
    lestrang,
    nac_mae,
    civil_mae,
    profis_mae,
    cracha_mae,
    cpf_mae,
    ci_mae,
    cracha_pai,
    naci_mae,
    estac_mae,
    rf,
    nom_f,
    pro_f,
    cpf_f,
    ci_f,
    eci_f,
    nac_f,
    dna_f,
    cra_f,
    rped,
    nom_ped,
    pro_ped,
    cpf_ped,
    ci_ped,
    eci_ped,
    nac_ped,
    dna_ped,
    cra_ped
)
VALUES
(
    m_j_codcli,
    m_j_nome,
    m_cind,
    m_oexp,
    m_cpff,
    m_sexo,
    m_natural,
    m_naciona,
    m_profiss,
    m_nac_res,
    m_cpf_res,
    m_cin_res,
    m_est_civ,
    m_data_mat,
    m_data_nas,
    m_pai,
    m_mae,
    m_data_nap,
    m_data_nam,
    m_endereco,
    m_cidade,
    m_bairro,
    m_estado,
    m_cep,
    m_telefone,
    m_telefon1,
    m_email,
    m_j_curso,
    m_j_serie,
    m_j_areas,
    m_ncurso,
    m_nserie,
    m_nareas,
    m_j_turma,
    m_j_turno,
    m_j_sala,
    m_j_situ,
    m_j_bols,
    m_descto,
    m_foto,
    m_J_CONV,
    m_NCONVE,
    m_MATRCONV,
    m_MATRREAL,
    m_numero,
    m_ecivil,
    m_certnasc,
    m_ota,
    m_lestrang,
    m_nac_mae,
    m_civil_mae,
    m_profis_mae,
    m_cracha_mae,
    m_cpf_mae,
    m_ci_mae,
    m_cracha_pai,
    m_naci_mae,
    m_estac_mae,
    m_rf,
    m_nom_f,
    m_pro_f,
    m_cpf_f,
    m_ci_f,
    m_eci_f,
    m_nac_f,
    m_dna_f,
    m_cra_f,
    m_rped,
    m_nom_ped,
    m_pro_ped,
    m_cpf_ped,
    m_ci_ped,
    m_eci_ped,
    m_nac_ped,
    m_dna_ped,
    m_cra_ped
);

END;

1 answer

6


NATURAL is a reserved Mysql word (see http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html)

Therefore, in the script, it should be replaced

(...)
INSERT INTO l01j14
(
    j_codcli,
    j_nome,
    cind,
    oexp,
    cpff,
    sexo,
    natural,
    naciona,
    profiss,
   (...)

for

(...)
INSERT INTO l01j14
(
    j_codcli,
    j_nome,
    cind,
    oexp,
    cpff,
    sexo,
    `natural`,
    naciona,
    profiss,
   (...)

That is, put the natural between backticks (`)

  • Now I understand very well, I am working on the conversion of a school system, which the company developed here and Fivewin + xHarbour, currently it can be said that he has everything except the webservice. Now I will be able to see what are the reserved words :) Reserved words from Mysql Thank you very much!

Browser other questions tagged

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