import java.sql. * ; import oracle.jdbc.OracleTypes; public class TestFunc ... { public void getFuncResult() throws SQLException,Exception ...{ String driver_class = "oracle.jdbc.driver.OracleDriver"; String connect_string = "jdbc:oracle:thin:@10.92.8.108:1521:orcl"; //String query = "{call GetCustomerInfo(?,?,?)}"; Connection conn; Class.forName(driver_class); conn = DriverManager.getConnection(connect_string, "lis", "lis"); CallableStatement cstmt = conn.prepareCall("begin GetCustomerInfo(?,?,?,?); end;"); cstmt.setString(1,"8692000200"); cstmt.setString(2,"2006-01-22"); cstmt.setString(3,"2006-01-23"); cstmt.registerOutParameter(4,OracleTypes.CURSOR); cstmt.execute(); // int i = cstmt.get ResultSet rset = (ResultSet)cstmt.getObject(4); ResultSetMetaData rsm = rset.getMetaData(); int columnCount = rsm.getColumnCount(); //int rowCout = rset.getFetchSize(); int a =0; while (rset.next()) ...{ a++; for (int j=0;j< columnCount;j++) ...{ System.out.print(rset.getObject(j+1)); } System.out.println(""); } System.out.println("共搜索到"+columnCount+"列记录!"); System.out.println("共搜索到"+a+"条记录!"); } public static void main (String args []) ...{ TestFunc tf=new TestFunc(); try ...{ tf.getFuncResult(); } catch(Exception e) ...{ e.printStackTrace(); } }}