質問

I use ibatis. And below is my query.

<select id="mnote" parameterClass="Map" resultMap="ContentStatismnote">

SELECT
 NVL(DAY, 'TOTAL') DAY
  , SUM(A), SUM(B), SUM(C)
  FROM
  (
    SELECT Z.*
     FROM TABLE Z
    where b.day between to_char(to_date('#startDt#'), 'yyyy.mm.dd') and to_char(to_date('#endDt#'), 'yyyy.mm.dd')
  )

GROUP BY ROLLUP(DAY);

And JSP page is this:

<colgroup>
                <col style="width:25%;"/>
                <col style="width:25%;"/>
                <col style="width:25%;"/>
                <col style="width:25%;"/>
            </colgroup>
            <thead>
            <tr>
                <th>DAY</th>
                <th>A</th>
                <th>B</th>
                <th>C </th>
            </tr>
            </thead>

            <tbody>

                <br><c:forEach var="contentStatis" items="${resultCount}" >
        <tr>
                <td align="center"><c:out value="${contentStatis.day}" /></td>
                <td align="center"><c:out value="${contentStatis.studentPkg}" /></td>
                <td align="center"><c:out value="${contentStatis.shared}" /></td>
                <td align="center"><c:out value="${contentStatis.nonShared}" /></td>
        <tr>        
        </c:forEach>
            </tbody>

When I run the query alone in TOAD, it runs fine and display data. But when I want to show the data in JSP, it shows me

--- Check the parameter mapping for the 'startDt' property.
--- Cause: java.sql.SQLException: 'Invalid column index

Can anyone help me?

役に立ちましたか?

解決

Try to alias fields and tables:

  SELECT
  NVL(DAY, 'TOTAL') DAY
  , SUM(A) SUMA, SUM(B) SUMB, SUM(C) SUMC --fields
  FROM
  (
  ) T --table
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top