ERROR: syntax error at end of input, Java - Postgres

30,631

You're missing a ) at the end of the statement and the table is surrounded with double quotes for no reason..

sentencia.execute("INSERT INTO Registros (accion,num_tarjeta,valor,fecha_accion_ano,fecha_accion_mes,fecha_accion_dia) VALUES ('recarga','','','','','')");

Share:
30,631
Admin
Author by

Admin

Updated on November 18, 2020

Comments

  • Admin
    Admin over 3 years

    I have used the next SQL statement but it fails in PostgreSQL.

    sentencia.execute("INSERT INTO \"Registros\" (accion,num_tarjeta,valor,fecha_accion_ano,fecha_accion_mes,fecha_accion_dia) VALUES ('recarga','" + num_tarjeta + "','" + valor_recargar + "','" + Calendar.getInstance().get(Calendar.YEAR) + "','" + Calendar.getInstance().get(Calendar.MONTH) + "','" + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "'");
    

    with this error:

    ERROR: syntax error at end of input
    

    What's the problem? Thanks