Revision: 8974
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 16, 2008 10:07 by emoseman
Initial Code
(Extracted from http://asktom.oracle.com/tkyte/ResultSets/) import java.sql.*; import java.io.*; import oracle.jdbc.driver.*; class curvar { public static void main (String args []) throws SQLException, ClassNotFoundException { String driver_class = "oracle.jdbc.driver.OracleDriver"; String connect_string = "jdbc:oracle:thin:@slackdog:1521:oracle8"; String query = "begin :1 := sp_listEmp; end;"; Connection conn; Class.forName(driver_class); conn = DriverManager.getConnection(connect_string, "scott", "tiger"); CallableStatement cstmt = conn.prepareCall(query); cstmt.registerOutParameter(1,OracleTypes.CURSOR); cstmt.execute(); ResultSet rset = (ResultSet)cstmt.getObject(1); while (rset.next ()) System.out.println( rset.getString (1) ); cstmt.close(); } }
Initial URL
Initial Description
Initial Title
Oracle Cursor Query
Initial Tags
textmate, query, Oracle
Initial Language
Other