public class DBPro { public static void main(String[] args) throws Exception { Class.farName("com.ibm.db2.jcc.DB2Driver"); Connection ct = DriverManager.getConnection("","",""); CallableStatement cs = ct.prepareCall("call update_trans(?)"); cs.registerOutParameter(1,java.sql.Types.INTEGER);//註冊輸出參數 cs.execute(); System.out.println(cs.getString(1)); cs.close(); ct.close(); } }