need advice about out parameter settings while calling stored procedure in Java code
От | Alex Wang |
---|---|
Тема | need advice about out parameter settings while calling stored procedure in Java code |
Дата | |
Msg-id | 91b75bc23fbe41adba69c52ed4c2213f@shmbx01.ebaotech.com обсуждение исходный текст |
Ответы |
Re: need advice about out parameter settings while calling stored
procedure in Java code
Re: need advice about out parameter settings while calling stored procedure in Java code |
Список | pgsql-jdbc |
Hi ,
I am migrating from Oracle to Postgresql, and have encountered below issue while calling stored procedure via the latest PG JDBC (postgresql-9.4-1201.jdbc4.jar).
Here is the procedure snippet:
----------start------------
PROCEDURE p_myprocedure(a character varying, b character varying, c character varying,d character varying, OUT o1 text, OUT o2 text) IS
BEGIN
Blalabla;
END;
----------end-------------
In my Java code, I have to set the value of the out parameters like input as bellowing:
stmt = con.prepareCall("{call xxx. p_myprocedure(?,?,?,?,?,?)}");
stmt.setString(1, "x1");
stmt.setString(2, "x21");
stmt.setString(3, "x3");
stmt.setString(4, "x4");
stmt.setString (5,"");//need to set the output value
stmt.setString (6,""); //need to set the output value
before invoking the ‘stmt.execute();’;
Otherwise, it will throw error like:
ERROR: function p_myprocedure (character varying, character varying, character varying, character varying) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
But setting output is unnecessary if I use Oracle DB or access Postgresql DB via EDB jdbc driver.
Is there any possible way to avoid such out parameter settings ?
Thanks & regards,
Alex
В списке pgsql-jdbc по дате отправления: