I've mapped some function that is being used as a wrapper for the one of the Oracle functions (I really need to call that Oracle function from my LINQ).
My mapping looks like (Storage Model):
<Function Name="RunTranslate" IsComposable="false" BuiltIn="false">
<CommandText>
SELECT Translate(@DataToTranslate using char_cs) AS ResultData FROM dual
</CommandText>
<Parameter Name="DataToTranslate" Type="char" Mode="In" />
</Function>
And:
<FunctionImport Name="OracleTranslate" ReturnType="Collection(String)">
<Parameter Name="DataToTranslate" Mode="In" Type="String" />
</FunctionImport>
I try to use it from the code this way:
using (var context = new TestEntities())
{
....
var result = from myData in context.OracleTranslate("test")
select myData; // Error ORA-00936!
....
}
I tried to use Entity Framework Profiler (EFProf) to see the query that is actually being sent to the DB. Intercepted query is the next:
SELECT Translate('test' /*@DataToTranslate*/ using char_cs) AS ResultData FROM dual
(looks fine)
But my application stops with the next error: ORA-00936: missing expression
If I copy-paste the intercepted query into the VS2010's Server Explorer Query Window - it works! DB returns correct data to me!
So, where the problem can be? What is the difference between the code and the query window in my case? I thought they use the same provider, etc...
Thank you very much!
EDIT:
I've just used standard Inet-sniffer to check the real data that is being sent over the sockets and Internet when I run my query.
And it's not the same with the first one! It's exactly my source SQL query:
SELECT Translate(@DataToTranslate using char_cs) AS ResultData FROM dual
It seems, that parameter is not recognized, but why?