sql="............";
 rs = stmt.executeQuery(sql);

解决方案 »

  1.   

    String sql = "select type,price from titles order by type compute sum(price) by ype compute sum(price)"
    String type = null;
    String price = null;
    conn = //getConnection
    PreparedStatement psm = null;
    ResultSet rs = null;
    try {
      psm = conn.prepareStatement(sql);
      rs = psm.executeQuery();
      while (rs.next()) {
        type = rs.getString(1);
        price = rs.getString(2);
      }
    } catch (SQLException sqlx) {
      System.out.println("Got SQLException ! " + sqlx.toString());
    } finally {
      try {
        if (rs != null)
          rs.close();
        if (psm != null)
          psm.close();
        if (conn != null)
          conn.close();
      } catch (Exception ex) {
        System.out.println("Can't close Connection : " + ex.toString());
      }
    }
      

  2.   

    打错了几个地方
    String sql = "select type,price from titles order by type compute sum(price) by ype compute sum(price)";
    Connection conn = //getConnection
      

  3.   

    调用oracle存储过程CallableStatement。"call pre_insert(?,?,?,?,?)"前三个问号是输入参数,后两个参数是输出参数。输入出参数就要你要的结果集。
      

  4.   

    笔误!调用oracle存储过程CallableStatement。"call pre_insert(?,?,?,?,?)"前三个问号是输入参数,后两个参数是输出参数。输出参数就要你要的结果集。
      

  5.   

    我想,用Hashtable是不是可以的
    Hashtable ht=new Hashtable();
    while (rs.next()) {
    int i=0;
        i++;
        type = rs.getString(1);
        price = rs.getString(2);
    ht.put("a"+i,type);
    ht.put("b"+i,price);
      }
    然后返回ht,
    JSP中就会接到多个结果集的
    jsp中同样用一个Hashtable来接收就可以了呀
      

  6.   

    1。获得结果集就用rs = stmt.executeQuery(sql);行了
    2。用getMoreResults获得多个结果集
      

  7.   

    Hashtable ht=new Hashtable();
    while (rs.next()) {
    int i=0;
        i++;
        type = rs.getString(1);
        price = rs.getString(2);
    ht.put("a"+i,type);
    ht.put("b"+i,price);
      }int i=0;放在循环里面???