babbitt99
2016-10-31 09:16
采纳率: 0%
浏览 1.1k

存储过程分页,java后台怎么调用执行

CREATE OR REPLACE PROCEDURE test01(p1 IN integer,p2 IN integer,p_count out integer,p_cur out sys_refcursor)
as
begin

  select count(t.log_user_id) into p_count from hpl_base_t_log t;

  open p_cur for 
      select * from (
           select ROWNUM row_number, temp_t.*
           from (

                select t.*
                from hpl_base_t_log t
                -- where t.log_user_id = 99
                order by t.log_write_time desc

            ) temp_t where ROWNUM<=p2
      ) temp_page_t
      where temp_page_t.row_number>=p1;

end;

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 孤单品尝寂寞 2016-10-31 09:54

    CALL test01 (?,?,?,?)

    打赏 评论
  • 光着脚丫_走 2016-10-31 10:37

    try {
    Class.forName(drive);
    Connection con=DriverManager.getConnection(url, name, password);
    ** String sql = "{call sel_pro(?)}";
    CallableStatement cs=con.prepareCall(sql);
    cs.registerOutParameter(1,oracle.jdbc.OracleTypes.CURSOR);****
    cs.execute();
    ResultSet rs=(ResultSet)cs.getObject(1);
    //System.out.println(cs.getString(1));
    while(rs.next()){
    System.out.println("============"+rs.getString(1)+rs.getString(2));
    }
    rs.close();
    cs.close();
    con.close();
    }

    打赏 评论

相关推荐 更多相似问题