Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
Postgresql jdbc executeUpdate() or getUpdateCount() return affected row

JDBC executeUpdate() and getUpdateCount() should return affected row number. Following java code calls a MySql stored procedure and variable "rc" is assigned to "1" which means 1 row was inserted:

CallableStatement stmt = conn.prepareCall("{call insertData(?)}");
stmt.setInt(1, i);
int rc = stmt.executeUpdate(); // returns 1
rc = stmt.getUpdateCount(); // returns 1

the MySql stored procedure called:

CREATE PROCEDURE insertData(IN i INT)
BEGIN
INSERT INTO table_name(column_name) VALUES(i);
END //

Everything works as expected. Now want the similar Java code to work with a PostgreSql function or procedure and make executeUpdate() or getUpdateCount() act the same and return affected row. New row is inserted into Postgresql table but executeUpdate() or getUpdateCount() always return 0.

create procedure insertData(i integer) as $$
begin
INSERT INTO table_name(column_name) VALUES(i);
end; $$ language plpgsql;

How can I make executeUpdate() or getUpdateCount() return affected row when calling a Postgresql function or procedure?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda