As seen here: http://www.postgresql.org/docs/7.4/static/jdbc-callproc.html
// Turn transactions off.
con.setAutoCommit(false);
// Procedure call.
CallableStatement upperProc = con.prepareCall("{ ? = call upper( ? ) }");
upperProc.registerOutParameter(1, Types.VARCHAR);
upperProc.setString(2, "lowercase to uppercase");
upperProc.execute();
String upperCased = upperProc.getString(1);
upperProc.close();
Can I instead do:
// Turn transactions off.
con.setAutoCommit(false);
// Procedure call.
CallableStatement upperProc = con.prepareCall("{call upper( ? ) }");
upperProc.setString(2, "lowercase to uppercase");
upperProc.execute();
upperProc.close();
I just remove the ? before call upper. My query just inserts so I dont need a value. I want to keep it in this forma becuase mysql also uses this format thus I can reuse a lot of code in JAVA.
SELECTwithout the need forCallableStatement(that's how they would be called inpsql).select upper(?). No need forCallableStatementin Postgres