Textual substitution for parameterized queries
----------------------------------------------
Key: IBATIS-85
URL: http://issues.apache.org/jira/browse/IBATIS-85
Project: iBatis for Java
Type: New Feature
Components: SQL Maps
Versions: 2.0.9b
Environment: SQL Server 2000, Win XP, Tomcat, JDK 1.4
Reporter: Vadim Pesochinskiy
Problem Description:
Unable to execute parameterized query using SQL Server TOP keyword. TOP allows
you to return the specified number of rows from a result set.
Query below fails with SQLException: Line 1: Incorrect syntax near '@P1'.
<select id="getRecentAlerts.sqlserver" resultMap="alertResult"
parameterClass="int">
SELECT TOP #value# *
FROM ods_exception_alert
ORDER BY alert_time DESC
</select>
This one executes OK (replaced "value" for troublshooting).
<select id="getRecentAlerts.sqlserver" resultMap="alertResult"
parameterClass="int">
SELECT TOP 5 *
FROM ods_exception_alert
ORDER BY alert_time DESC
</select>
I know this is JDBC driver problem, but it would be great if iBATIS allowed
doing text substitutions as a work-around. At the moment I guess I will have to
rewrite SQL with sub selects. Is there another way to work-around this?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira