Monday, August 31, 2009

ORA-00939: too many arguments -when case arguments exceed 255

Problem Description
In all Oracle 10.1g and oracle 10.2.0.1, 10.2.0.2, 10.2.0.3 whenever there is more than 255 arguments inside CASE statements then following error is returned.

ORA-00939: too many arguments for function

But surprisingly on Oracle 9.2 database the same code does not return any error.

Cause of the Problem
As we see the same code return error in 10g but it is well on 9.2. In fact this is problem of oracle 9.2 that it does not return any error. It should return error if there is more than 255 arguments inside CASE statements. In oracle 9.2 this is bug number 2909927 and this bug is fixed in oracle 10.1 and 10.2. That's why in 10.2 and 10.1 error returns if arguments exceed 255.

Up to Oracle 10.2.0.3 and earlier version, the arguments of CASE statement is limit to 255 and it does not support exceed over 255 and hence error return if it exceed. However in Oracle 10.2.0.4 and later the arguments limit of CASE statement has increased to 32767.

Solution of the Problem
Option 01:
-If you are in oracle version 10.2.0.3 or earlier then enforce a restriction so that arguments of CASE statement does not exceed 255.

-Another thing to keep in mind that CASE statements can be nested. So if possible you can nest CASE statements and thus support your application to work.

Option 02:
Upgrade to oracle database 10.2.0.4 or higher where the arguments limit of CASE statement has increased to 32767.

0 comments:


Copyright © 2008 Shaik Abdul Khaleel Technical blog. All rights reserved.