Ganesh, It looks like the error is coming from SQL Server so I would have to assume that it is pushed down.
Ylai20,
What version of SQL Server are you using? It sounds like a very old version. My install of SQL Server 2008R2 allows more than 10 case expressions.
My immediate thought was that it’s a SQL Server limitation rather than DS. I think the problem may be that the generated SQL is nested CASEs rather than a single linear CASE statement:
so you get
CASE …
WHEN …
ELSE
…CASE …
…WHEN …
…ELSE
…CASE …
…WHEN …
…ELSE …
…END
…END
END
instead of
CASE …
WHEN …
WHEN …
ELSE
END
(excuse the full stops, the BB takes out spaces, and my T_SQL syntax may not be quite right, but it should be enough to demonstrate my point)
This is because decode() allows for conditions of different types to be evaluated in a single statement, and DS should push those down as a set of nested SQL if - then statements. A SQL CASE should be used to evaluate different conditions against a single variable, but that isn’t how the decode() syntax works.
I seem to recall Oracle has a limit on how many WHEN clauses you can have in a single CASE - maybe 128? - I know I hit this limit once or twice.
I also faced similar issue when using decode in BODS 4.0 where in we were not able to execute the decode() with more than 10 conditions.
Its a licensing issue where in SQL Server 2008 R2 has a limitation to process 10 conditions in CASE .
Arrange the 10 statements using decode() and remaining conditions in another decode statement. Combine both the decode statements using an OR statement.
This should work.
Either you can create a function in SQL Server which acts like decode