Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda