当我运行下面的SQL时,我遇到了以下错误
FuncTwo(ParamOne,ParamTwo)InnedColTwo,*
ORA-06502:PL/SQL:数值或值错误:数字精度太大ORA-06512:在“Schema.FuncTwo”,第89行
SELECT
C.UID AS ColOne,
TO_NUMBER(C.ColTwo) AS ColTwo
FROM (
SELECT
B.UID,
TO_NUMBER(B.MiddleColTwo) AS OuterColTwo
FROM (
SELECT
A.UID,
CASE
WHEN (InnerColThree >= '54.6' AND InnerColThree <= '54.9') OR InnerColThree = '0' THEN 99
ELSE TO_NUMBER(InnerColTwo, '99.9')
END AS MiddleColTwo
FROM (
SELECT
UID,
FuncTwo(ParamOne, ParamTwo) InnerColTwo,
FuncThree(ParamOne, ParamTwo) InnerColThree
FROM
-- SOME STUFF
WHERE
-- SOME STUFF
UNION
SELECT
UID,
FuncTwo(ParamOne, ParamTwo) AS InnerColTwo,
FuncThree(ParamOne, ParamTwo) AS InnerColThree
FROM
-- SOME STUFF ...
WHERE
-- SOME STUFF ...
) A
) B
WHERE B.ColTwo > 0 --Works when commented out. Throws error when uncommented.
) C;
但是当我注解掉WHERE B.ColTwo > 0
时,查询就可以工作了。我尝试用TO_NUMBER()为所有ColTwo值指定数字格式,但没有任何帮助。
我不明白为什么当中间的查询where子句被注解掉时,查询会解析,但当它被取消注解时,查询会失败。
该列的所有值都解析为0到99之间的值,没有小数或负值或大于99的值。
有人能帮我解决这个问题吗?
1条答案
按热度按时间muk1a3rh1#
在where子句
Where TO_NUMBER(B.MiddleColTwo) > 0
中添加此内容