java.sql.SQLException: while executing SQL: select e.NAME, CASE WHEN e.dept_ID = (select d.ID from PV_ADMIN.dept d where d.NAME = 'SALES') then 'SALES' ELSE 'Not Matched.' END as department from PV_ADMIN.EMP e

Google Groups | kunal mahale | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Is there any way to use sub-queries in CASE statement ?

    Google Groups | 3 years ago | kunal mahale
    java.sql.SQLException: while executing SQL: select e.NAME, CASE WHEN e.dept_ID = (select d.ID from PV_ADMIN.dept d where d.NAME = 'SALES') then 'SALES' ELSE 'Not Matched.' END as department from PV_ADMIN.EMP e

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at net.hydromatic.optiq.impl.jdbc.JdbcRules.addSelect()
    2. Calcite Core
      MetaImpl.prepare
      1. net.hydromatic.optiq.impl.jdbc.JdbcRules.addSelect(JdbcRules.java:76)
      2. net.hydromatic.optiq.impl.jdbc.JdbcRules.access$1300(JdbcRules.java:50)
      3. net.hydromatic.optiq.impl.jdbc.JdbcRules$JdbcAggregateRel.implement(JdbcRules.java:556)
      4. net.hydromatic.optiq.impl.jdbc.JdbcImplementor.visitChild(JdbcImplementor.java:93)
      5. net.hydromatic.optiq.impl.jdbc.JdbcRules$JdbcJoinRel.implement(JdbcRules.java:242)
      6. net.hydromatic.optiq.impl.jdbc.JdbcImplementor.visitChild(JdbcImplementor.java:93)
      7. net.hydromatic.optiq.impl.jdbc.JdbcRules$JdbcProjectRel.implement(JdbcRules.java:426)
      8. net.hydromatic.optiq.impl.jdbc.JdbcImplementor.visitChild(JdbcImplementor.java:93)
      9. net.hydromatic.optiq.impl.jdbc.JdbcToEnumerableConverter.generateSql(JdbcToEnumerableConverter.java:271)
      10. net.hydromatic.optiq.impl.jdbc.JdbcToEnumerableConverter.implement(JdbcToEnumerableConverter.java:81)
      11. net.hydromatic.optiq.rules.java.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:65)
      12. net.hydromatic.optiq.prepare.OptiqPrepareImpl$OptiqPreparingStmt.implement(OptiqPrepareImpl.java:699)
      13. net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:276)
      14. net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:178)
      15. net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare2_(OptiqPrepareImpl.java:333)
      16. net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare_(OptiqPrepareImpl.java:242)
      17. net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepareSql(OptiqPrepareImpl.java:211)
      18. net.hydromatic.optiq.jdbc.OptiqConnectionImpl.parseQuery(OptiqConnectionImpl.java:142)
      19. net.hydromatic.optiq.jdbc.MetaImpl.prepare(MetaImpl.java:603)
      19 frames
    3. Calcite Avatica
      AvaticaStatement.executeQuery
      1. net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:77)
      1 frame
    4. net.hydromatic.optiq
      TestOptiq.main
      1. net.hydromatic.optiq.impl.mongodb.TestOptiq.main(TestOptiq.java:605)
      1 frame