Hi, I'm trying to make a PL/pgSQL function to update
or insert if the row is not present. I tested the
function and it works fine, but when I call it through
JDBC, it executes, but the row is not inserted or
updated. This is my JDBC code.
try{
connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
connection.setAutoCommit(false);
statement = connection.prepareCall("{? =
call save(?,?,?)}");
statement.registerOutParameter(1,
Types.INTEGER);
statement.setObject(2, null);
statement.setObject(3, null);
statement.setObject(4, "1234");
statement.executeUpdate();
id = (Integer)statement.getObject(1);
connection.commit();
} catch(SQLException e){
try{
connection.rollback();
} catch(SQLException e2){
e2.printStackTrace();
}
e.printStackTrace();
}
I am getting the following exception:
org.postgresql.util.PSQLException: ERROR: function
save("unknown", "unknown", character varying) does not
exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:297)
...
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/