标签:not except ble oracle word bat oid pre obj
1.oracle Package包名EHIS.JH_INTERFACE_PKG
请求参数 P_LEDTYPE Number, LED类型 1是女科,2是男科
X_REF OUT SYS_REFCURSOR 返回的数据集合
2
package pojo; import oracle.jdbc.OracleTypes; import java.sql.*; import java.util.ArrayList; public class JdbcProcedureTest { public static void main(String[] args) throws ClassNotFoundException, SQLException { ArrayList<ClinicJhlish> list=new ArrayList<ClinicJhlish>(); String driver = "oracle.jdbc.driver.OracleDriver"; /*String url = "jdbc:mysql://127.0.0.1:3306/ump?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=TRUE";*/ String url = "jdbc:oracle:thin:@//192.168.6.240:1521/hissdbs"; String user = "Oracle"; String password = "root123"; Class.forName(driver); Connection conn = DriverManager.getConnection(url, user, password); String sql = "{call EHIS.JH_INTERFACE_PKG.QUERY_CLINICJHLIST(?,?)}";/*EHIS.JH_INTERFACE_PKG 包名*/ CallableStatement stmt = conn.prepareCall(sql);//jdbc执行过程//调用格式 {call 存储过程名(参数)} stmt.setObject(1,1);//索引1,第1个id LED类型 /*stmt.setObject(3, "3");*/ /*stmt.registerOutParameter(1, Types.VARCHAR);*/ /*返回类型例子 stmt.registerOutParameter(4, java.sql.Types.VARCHAR); //注册返回类型(sql类型),输出参是(vresult out varchar2) Object objRtn = stmt.getObject(4); //得到返回值*/ stmt.registerOutParameter(2, OracleTypes.CURSOR);//输出参数的话要注册 oracle返回集合 X_REF OUT SYS_REFCURSOR 返回的数据集合 stmt.execute();//注册后要更新 ResultSet resultSet = (ResultSet) stmt.getObject(2);//这个是索引的意思 while (resultSet.next()){ ClinicJhlish cj=new ClinicJhlish(); cj.setCALLID(resultSet.getString("CALLID")); cj.setROOMID(resultSet.getString("ROOMID")); System.out.println(resultSet.getString("CALLID")+":"+resultSet.getString("ROOMID"+"")); list.add(cj); } } }
标签:not except ble oracle word bat oid pre obj
原文地址:https://www.cnblogs.com/kkxwze/p/11135281.html