Why I'm getting an error informing that "a result was not expected" when executing stored procedures on PostgreSQL from Java in a batch? -
I have this process in the database:
create or replace functions Functions per page Return to Zero Outline as Copy (ID INT, Value REAL) $$ Page Relevance Values (ID, Value); Exception when unique_iolation then updated page relevance SET relevance = value WHERE pageId = id; END $ $ LANGUAGE plpgsql; and this code that calls this function:
Select the private last string PAGE_RELEVANCE_SQL = "replace page copy (?,?,: Real) "; Try (cobbler ctm = conn.prepareCall (PAGE_RELEVANCE_SQL)) {for (Entry & lt; integer, double> entry: weightMap.entrySet ()) {cstm.setInt (1, entry.getKey ()); Cstm.setDouble (2, entry.getValue ()); Cstm.addBatch (); } Cstm.executeBatch (); } Hold (SQLException e) {LOGGER.error ("error in search of page relevance:" + e.getNextException ()); }} When I execute a batch, the value is converted or converted into a table, but after that, I get an exception while informing that There was a result when no one was expecting to return. I do not know what is wrong, if the way I say process or process myself, what could be the problem and how can it be solved?
Call a process with SELECT What is the right / the only way?
I can tell you that you are using SELECT when < Code> calls should be used. From the example:
// Close the transaction. Con.setAutoCommit (wrong); // Process Call Callable Stemment Upper Practical = CO Preperal ("{? = Make upper call (?)}"); Upper Process Registryautompermator (1, type .VARCHAR); Upper Procrastruct string (2, "lowercase to uppercase"); UpperProc.execute (); String upper sealed = uppercut less string (1); UpperProc.close (); Note that ? = Call for result syntax is unnecessary in your case - you only want to use the call relevance of the copy page (?,?, :: real) The syntax is different from the actual PostgreSQL because it is a part of it.
Comments
Post a Comment