Reputation: 45
I know there are related questions, but most of the resolutions I have come across on the web have the same solution, take the semicolon predecessor off your statement in the where clause. However, this won't work for me because I don't have a semicolon.
I am using MyBatis and running NUnit tests.
MyBatisCode
<select id="GetLineNumber" parameterClass="HashTable" resultClass="long">
<![CDATA[
SELECT
HP.LINE_NUM
FROM
ODS.HAIL_PLCY_LINE_NUM
WHERE
PLCY_ID = #PolicyId#
AND HCL_ID = #HailCoverageId#
</select>
C# Code: ...
Hashtable lineNumberHash = new Hashtable
{
{"PolicyId",x.PolicyId}
,{"HailCoverageId",x.Id}
};
lastDatabaseCoverage.AddRange(IbatisSqlMapper.QueryForList<T>("GetLineNumber", lineNumberHash));
"X" in the above code is an object and the properties PolicyId and Id are valid so please disregard the bit of contextualless information!
Note that I am used to SQL Server so if the Select, From, Where is off then I apologize for the easy fix.
I keep getting the "ORA01036 illegal variable..." message
This is my first question so I don't know how fast they get answered, hopefully fairly quickly though :-)
Thanks in advance!
Upvotes: 2
Views: 913
Reputation: 45
PICNIC problem.
The reason the CDATA tag wasn't closed is because I was copy/pasting from my code. What I failed to do was post the entire message. I had some of the code commented out. I didn't think that adding comments was a no-no, but after looking at it again I realized that the CDATA tag is a literal.
Taking comments out of the tag (so they aren't being read so literally) fixed the problem. I now have a result mapping issue, but at least I got past this illegal variable nonsense.
Thanks for the help and the wiki article!
Upvotes: 1
Reputation: 183251
The only problem I see is that you need to close the CDATA section that you've wrapped the query in. To do that, change this:
AND HCL_ID = #HailCoverageId#
</select>
to this:
AND HCL_ID = #HailCoverageId#
]]>
</select>
Upvotes: 0