0
        PreparedStatement psmt = con.prepareStatement("Select * From EVENTS WHERE E_STATUS='PendingApproval' OR E_STATUS='Modify'OR E_STATUS='CancelRequest'");
        ResultSet rs = psmt.executeQuery();

        EventShow row = null;
        /* here assume i have multiple rows in the result set */
        while (rs.next()) {

//我想在这里添加另一个选择查询。因为我想将不同//表中的其他数据添加到同一个对象。

            row = new EventShow();
            row.setEventid(rs.getInt("E_ID"));
            //row.setEventdate(rs.getString("E_Date"));
            row.setEventName(rs.getString("E_NAME"));
            row.setStatus(rs.getString("E_STATUS"));
            //row.setLastmodify(rs.getDate("TO_CHAR(E_AUTH_TIME,'YYYY/MM/DD:HH:MM')"));
            //row.setLastmodify(nvl(rs.getDate("TO_CHAR(E_AUTH_TIME,'YYYY/MM/DD:HH:MM')")),'00/00/0000');
           // row.setLastmodify(TO_CHAR(nvl(rs.getDate("E_AUTH_TIME"),'00/00/0000')),'YYYY/MM/DD:HH:MM');
            //row.setLastmodify(rs.getString"(nvl(TO_CHAR(MDATE_FROM,'YYYYMMDD'),'')");


            event_show.add(row);
        }
4

1 回答 1

0

这是有关如何执行此操作的伪代码:

    PreparedStatement psmt = con.prepareStatement("Select * From EVENTS WHERE E_STATUS='PendingApproval' OR E_STATUS='Modify'OR E_STATUS='CancelRequest'");
    ResultSet rs = psmt.executeQuery();

    EventShow row = null;
    while (rs.next()) {
        row = new EventShow();
        row.setEventid(rs.getInt("E_ID"));
        //row.setEventdate(rs.getString("E_Date"));
        row.setEventName(rs.getString("E_NAME"));
        row.setStatus(rs.getString("E_STATUS"));
        /////////////////////////////////////////////
        PreparedStatement psmt2 = con.prepareStatement("Select Query");
        ResultSet rs2 = psmt.executeQuery(); 
        // Now work on the rs2 inside another while loop
        /////////////////////////////////////////////
        //row.setLastmodify(rs.getDate("TO_CHAR(E_AUTH_TIME,'YYYY/MM/DD:HH:MM')"));
        //row.setLastmodify(nvl(rs.getDate("TO_CHAR(E_AUTH_TIME,'YYYY/MM/DD:HH:MM')")),'00/00/0000');
       // row.setLastmodify(TO_CHAR(nvl(rs.getDate("E_AUTH_TIME"),'00/00/0000')),'YYYY/MM/DD:HH:MM');
        //row.setLastmodify(rs.getString"(nvl(TO_CHAR(MDATE_FROM,'YYYYMMDD'),'')");


        event_show.add(row);
    }
于 2013-07-10T03:55:09.340 回答