刚研究plsql,编写的pl在数据库可以输出,把dbms删掉用java调用就报这个错误plsql:
create or replace PROCEDURE COUNT_SCORE(outcursor out cursortype.cursortype) AS
  thename fs_eietoes_07.fs_name%type;
  phone fs_eietoes_07.FS_TELEPHONE%type;
  city fs_eietoes_07.FS_CITY%type;
  town fs_eietoes_07.FS_TOWN%type;
  chapter fs_eietoes_07.FS_CLASS%type;
  thenum number(5);
  state fs_eietoes_07.FS_SENDSTATE%type;
 
  cursor mycursor is
    select FS_NAME,FS_TELEPHONE,FS_CITY,FS_TOWN,FS_CLASS,FS_SENDSTATE,count(1) as thenum 
    from fs_eietoes_07
    where length(FS_TITLESHORT)=17
    group by FS_NAME, FS_TELEPHONE, FS_CITY, FS_TOWN, FS_CLASS, FS_SENDSTATE;
BEGIN
  open mycursor;
end;
java:public static void main(String[] args) {
try {
Connection connection = JdbcConnetionUtilOracl.getJdbcConnection();
String sql = "{call count_score(?)}";
CallableStatement cs;
 
cs = connection.prepareCall(sql);
cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.execute();
ResultSet rs = (ResultSet) cs.getObject(1);
while (rs.next()) {
System.out.println("name:" + rs.getString(1) + "/tphone:"
+ rs.getString(2) + "/tcity:" + rs.getString(3)
+ "/ttown:" + rs.getString(4) + "/tchapter:"
+ rs.getString(5) + "/tstate:" + rs.getInt(6)
+ "/tthenum:" + rs.getInt(7));
}
cs.close();
JdbcConnetionUtilOracl.closeConnection(connection);
} catch (Exception e) {
e.printStackTrace();
}
}异常是在cs.getObject(1)的时候报的,不是rs.next