Pages

Saturday, November 30, 2013

How to resolve too many declarations of 'TO_CHAR' match this call

Have you ever got message
"ORA-06550: line 3, column 9:
PLS-00307: too many declarations of 'TO_CHAR' match this call
ORA-06550: line 3, column 2:
PL/SQL: SQL Statement ignored" ? 


If so, it is the right place for you :). This post will discuss about "How to resolve too many declarations of 'TO_CHAR' match this call" in oracle.

The problem is that your pl/sql is selecting something like '0' and returning a string. The result is that you are attempting to perform a to_char function on a char variable.

we can solve it by either remove the single quotes from the inline view
DECLARE

CURSOR c1 IS
SELECT TO_CHAR(NVL(a.foo,'0'),'999')
FROM
(SELECT 0 foo FROM dual) a;
BEGIN
NULL;

END;

or
convert a.foo to a number via the to_number function:

DECLARE

CURSOR c1 IS
SELECT TO_CHAR(NVL(TO_NUMBER(a.foo),'0'),'999')
FROM
(SELECT '0' foo FROM dual) a;
BEGIN
NULL;

END;
That's all from us, hope this help.

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget