Skip to Content
author's profile photo Former Member
Former Member

SQL Case Statement Problem with Maxdb

Hello,

I'm running a J2E application on Netweaver AS. I have on problem that I just cannot figure out.

The statement works in SQL Studio but when I try to code it it does not work at all.

select COLA, SUM(CASE WHEN COLB=10 THEN 1 ELSE 0 END) from TABLE group by COLA

When executed as statement in Java I get:

Error [javax.servlet.ServletException: java.lang.IllegalStateException: illegal stack size: 4

contents:

com.sap.sql.tree.SelectStatement

com.sap.sql.tree.IntegerLiteral

com.sap.sql.tree.IntegerLiteral

com.sap.sql.tree.ComparisonPredicate], with root cause [java.lang.Exception: java.lang.IllegalStateException: illegal stack size: 4

contents:

com.sap.sql.tree.SelectStatement

com.sap.sql.tree.IntegerLiteral

com.sap.sql.tree.IntegerLiteral

com.sap.sql.tree.ComparisonPredicate].

Any thoughts on that? Thanks!

Edited by: MD on Feb 18, 2009 7:37 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 19, 2009 at 09:54 AM

    Hi MD,

    with SQL Studio you mean you work with MaxDB?

    Are you sure you're working directly on MaxDB and not with OpenSQL? (That's different!)

    If you want the first, try setting SQL type "vendor" or "native sql". In such case you have to define a new custom datasource through configuration. How that works depends on the version you are using.

    Try to find out what the actual error message is. The stack trace is not enough. There should be more.

    Regards,

    Benny

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2009 at 09:22 AM

    Thanks for the link. But I guess then the case statement is not possible in open SQL, even though it is a reserved keyword.

    Any other tips?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.