ORA-01722:实体框架上的无效数 [英] ORA-01722: invalid number on Entity Framework
问题描述
PROCEDURE GET_TIM_USER_CUSTO(P_ANOMES IN VARCHAR,USER_CUSTO OUT SYS_REFCURSOR )
IS
BEGIN
OPEN USER_CUSTO FOR
SELECT ID,COD_UTILIZADOR,ANO_MES,
TO_NUMBER(DESENCRIPTAR_DADO(CUSTO,(SELECT VALOR
FROM TIM_CONFIG
WHERE PARAMETRO ='CRIPT_KEY')))CUSTO,
TO_NUMBER(DESENCRIPTAR_DADO(CUSTO_EXTRA,(SELECT VALOR
FROM TIM_CONFIG
WHERE PARAMETRO ='CRIPT_KEY' )))CUSTO_EXTRA
FROM TIM_USER_CUSTO
WHERE SUBSTR(P_ANOMES,1,4)= SUBSTR(ANO_MES,1,4);
END GET_TIM_USER_CUSTO;
如果我直接在Oracle上执行它,则返回一个结果集。但是如果我使用实体框架在WebService中调用此存储过程
ORA-01722:无效数
调用:
ObjectResult< USER_CUSTO> aux = context.TIM_FUNCTIONS_GET_TIM_USER_CUSTO(sAnoMes);
然后它会抛出异常,不会产生任何结果。
使用存储过程与实体可能是一件非常复杂的事情,我非常沮丧,当我第一次尝试。无论如何,一切都在实体... exept存储过程中运行良好。如果其中一个可以帮助你,我真的建议你阅读下面的这些问题/答案,并尝试找到你的方式,祝你好运!
I'm executing a stored procedure from Oracle DB that is:
PROCEDURE GET_TIM_USER_CUSTO(P_ANOMES IN VARCHAR, USER_CUSTO OUT SYS_REFCURSOR)
IS
BEGIN
OPEN USER_CUSTO FOR
SELECT ID, COD_UTILIZADOR,ANO_MES,
TO_NUMBER(DESENCRIPTAR_DADO(CUSTO, (SELECT VALOR
FROM TIM_CONFIG
WHERE PARAMETRO='CRIPT_KEY'))) CUSTO,
TO_NUMBER(DESENCRIPTAR_DADO(CUSTO_EXTRA, (SELECT VALOR
FROM TIM_CONFIG
WHERE PARAMETRO='CRIPT_KEY'))) CUSTO_EXTRA
FROM TIM_USER_CUSTO
WHERE SUBSTR(P_ANOMES, 1, 4)=SUBSTR(ANO_MES, 1, 4);
END GET_TIM_USER_CUSTO;
If I execute it on the Oracle directly it returns a result set well. But If I call this stored procedure in a WebService using Entity Framework
ORA-01722: invalid number
Calling:
ObjectResult<USER_CUSTO> aux = context.TIM_FUNCTIONS_GET_TIM_USER_CUSTO(sAnoMes);
Then it throws an exception, doesn't give any result.
Using stored procedure with entity can be an extremely complicated thing, i've been extremely frustrated when i first tried. Everything works well in entity... exept stored procedure... anyway. If one of these can help you, i realy suggest you read these questions/answers below and try to find your way out of this, good luck !
using stored procedure in entity framework
Getting data from stored procedure with Entity Framework
Sql Stored proc and Entity framework 6
这篇关于ORA-01722:实体框架上的无效数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!