Entity Framework EndsWith error - ORA-10136: illegal variabl
Posted: Thu 11 Feb 2010 17:22
Hi, I'm trying to execute the following linq query:
(where str is a string variable) and I'm getting a Devart.Data.Oracle.OracleException:
"ORA-01036: illegal variable name/number"
Using DbMonitor, I see the following PREPARE line:
The exception is caused by the EndsWith clause. Can anyone see why this would result in that exception?
What's really weird is that if I change EndsWith to StartsWith, the query executes successfully, with the following SQL:
Thanks
Code: Select all
Dim names As List(Of CO_NAME) = (From n As CO_NAME In model.CO_NAME Where n.COMPANY_NAME.EndsWith(str) Select n).ToList
"ORA-01036: illegal variable name/number"
Using DbMonitor, I see the following PREPARE line:
Code: Select all
SELECT
1 AS C1,
"Extent1".NAME_ID AS NAME_ID,
"Extent1".COMPANY_NAME AS COMPANY_NAME,
"Extent1".DO_BUS_AS_FLAG AS DO_BUS_AS_FLAG,
"Extent1".DATE_ENDED AS DATE_ENDED,
"Extent1".MODIFIEDBY AS MODIFIEDBY,
"Extent1".DATEMODIFIED AS DATEMODIFIED,
"Extent1".COMPANY_ID AS COMPANY_ID
FROM AIP.CO_NAME "Extent1"
WHERE "Extent1".COMPANY_NAME LIKE '%' || :p__linq__2What's really weird is that if I change EndsWith to StartsWith, the query executes successfully, with the following SQL:
Code: Select all
SELECT
1 AS C1,
"Extent1".NAME_ID AS NAME_ID,
"Extent1".COMPANY_NAME AS COMPANY_NAME,
"Extent1".DO_BUS_AS_FLAG AS DO_BUS_AS_FLAG,
"Extent1".DATE_ENDED AS DATE_ENDED,
"Extent1".MODIFIEDBY AS MODIFIEDBY,
"Extent1".DATEMODIFIED AS DATEMODIFIED,
"Extent1".COMPANY_ID AS COMPANY_ID
FROM AIP.CO_NAME "Extent1"
WHERE "Extent1".COMPANY_NAME LIKE :p__linq__1 || '%'