jsp oracle쿼리문 질문드립니다..

rmacnt의 이미지

public List selectList(List whereCond, Map valueMap, int startRow, int endRow)
throws Exception
{
if(valueMap == null) valueMap = Collections.EMPTY_MAP;

Connection conn = null;
PreparedStatement pstmtMessage = null;
ResultSet rsMessage = null;

try
{
StringBuffer query = new StringBuffer(200);

query.append("select * from( ");
query.append("select THEME_MESSAGE_ID, GROUP_ID, ORDER_NO, LEVELS," +
"PARENT_ID, REGISTER, NAME, EMAIL, IMAGE, PASSWORD, TITLE," +
"ROWNUM rnum ");
query.append("from( ");
query.append("select THEME_MESSAGE_ID, GROUP_ID, ORDER_NO, LEVELS," +
"PARENT_ID, REGISTER, NAME, EMAIL, IMAGE, PASSWORD, TITLE ");
query.append("from THEME_MESSAGE ");

if(whereCond != null && whereCond.size() > 0)
{
query.append("where ");

for(int i = 0; i {
query.append(whereCond.get(i));

if(i < whereCond.size() - 1)
{
query.append(" or ");
}
}
}
query.append("order by GROUP_ID desc, ORDER_NO asc ");
query.append(") where ROWNUM<=? ");
query.append(") where rnum>=? ");

conn = getConnection();

pstmtMessage = conn.prepareStatement(query.toString());
Iterator keyIter = valueMap.keySet().iterator();

while(keyIter.hasNext())
{
Integer key = (Integer)keyIter.next();
Object obj = valueMap.get(key);

if(obj instanceof String)
{
pstmtMessage.setString(key.intValue(), (String)obj);
}
else if(obj instanceof Integer)
{
pstmtMessage.setInt(key.intValue(), ((Integer)obj).intValue());
}
else if(obj instanceof Timestamp)
{
pstmtMessage.setTimestamp(key.intValue(), (Timestamp)obj);
}
}

pstmtMessage.setInt(valueMap.size() + 1, endRow + 1);
pstmtMessage.setInt(valueMap.size() + 2, startRow + 1);

rsMessage = pstmtMessage.executeQuery();

if(rsMessage.next())
{
List list = new java.util.ArrayList(endRow - startRow + 1);

do
{
Theme theme = new Theme();
theme.setId(rsMessage.getInt("THEME_MESSAGE_ID"));
theme.setGroupId(rsMessage.getInt("GROUP_ID"));
theme.setOrderNo(rsMessage.getInt("ORDER_NO"));
theme.setLevels(rsMessage.getInt("LEVELS"));
theme.setParentId(rsMessage.getInt("PARENT_ID"));
theme.setRegister(rsMessage.getTimestamp("REGISTER"));
theme.setName(rsMessage.getString("NAME"));
theme.setEmail(rsMessage.getString("EMAIL"));
theme.setImage(rsMessage.getString("IMAGE"));
theme.setPassword(rsMessage.getString("PASSWORD"));
theme.setTitle(rsMessage.getString("TITLE"));
list.add(theme);
}while(rsMessage.next());

return list;

}
else
{
return Collections.EMPTY_LIST;
}
}catch(SQLException ex){
ex.printStackTrace();
throw new Exception("selectList", ex);
}finally{
if(rsMessage != null)
try { rsMessage.close(); } catch(SQLException ex) {}
if(pstmtMessage != null)
try { pstmtMessage.close(); } catch(SQLException ex) {}
if(conn != null) try { conn.close(); } catch(SQLException ex) {}
}
}

이쿼리문은 오라클용이더라구요..

저는 mysql을 사용하는데 mysql은 서브쿼리가 안되가지고 애가먹고있습니다..

저걸 mysql용으로 좀 바꿔주셧으면 감사하겟습니다

부탁드립니다..

급해서요 ㅠㅠ

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.