This discussion is archived
1 Reply Latest reply: Jul 30, 2012 5:42 AM by GregGaszewski RSS

Two likes in case throws error

GregGaszewski Newbie
Currently Being Moderated
Hi I have a big mapping that uses case statement and I have a problem.
Anytime I try to use more than two 'likes' in query on my staging table (SME) it gives me error.
Can anyone tell me why this is happenning?

Sample Query (on SME):

select CASE
WHEN C6_KONTO_WLASCIWE LIKE '706%'
THEN 'Przychody od jednostek powiazanych1'
WHEN C6_KONTO_WLASCIWE LIKE '707%'
THEN 'Przychody od jednostek powiazanych2'
ELSE 'BRAK MAPOWANIA'
END
"Pozycja (Konto)",C1_OKRES "Okres",'Okresowo' "Widok",'Integracja' "Wersja",C2_MPK "MPK",C3_ROK "Rok",NVL(C8_MEMBERNAME, 'KON99999') "Kontrahent",'Wykonanie' "Scenariusz",C4_WALUTY "Waluty",C5_DATA "Data" from "C_0PDZ_SF_Plan1Data" left outer join "C_1PDZ_SF_Plan1Data" ON C9_KONTRAHENT=C8_MEMBERNAME where      (1=1)

Error:
java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException: 2 2


StackTrace:

See com.borland.dx.dataset.DataSetException error code: BASE+66
com.borland.dx.dataset.DataSetException: java.lang.ArrayIndexOutOfBoundsException: 2 2
     at com.borland.dx.dataset.DataSetException.a(Unknown Source)
     at com.borland.dx.dataset.DataSetException.throwException(Unknown Source)
     at com.borland.dx.dataset.DataSetException.SQLException(Unknown Source)
     at com.borland.dx.sql.dataset.Database.createPreparedStatement(Unknown Source)
     at com.borland.dx.sql.dataset.o.a(Unknown Source)
     at com.borland.dx.sql.dataset.o.d(Unknown Source)
     at com.borland.dx.sql.dataset.o.f(Unknown Source)
     at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
     at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
     at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
     at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
     at com.borland.dx.sql.dataset.QueryDataSet.executeQuery(Unknown Source)
     at com.sunopsis.graphical.frame.edit.AbstractEditFrameGridBorland$1.actionPerformed(AbstractEditFrameGridBorland.java:279)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
     at java.awt.Component.processMouseEvent(Component.java:6505)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
     at java.awt.Component.processEvent(Component.java:6270)
     at java.awt.Container.processEvent(Container.java:2229)
     at java.awt.Component.dispatchEventImpl(Component.java:4861)
     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     at java.awt.Component.dispatchEvent(Component.java:4687)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
     at java.awt.Container.dispatchEventImpl(Container.java:2273)
     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     at java.awt.Component.dispatchEvent(Component.java:4687)
     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
     at java.awt.EventQueue.access$000(EventQueue.java:102)
     at java.awt.EventQueue$3.run(EventQueue.java:662)
     at java.awt.EventQueue$3.run(EventQueue.java:660)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
     at java.awt.EventQueue$4.run(EventQueue.java:676)
     at java.awt.EventQueue$4.run(EventQueue.java:674)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Chained exception:
java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException: 2 2
     at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
     at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
     at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
     at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:601)
     at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
     at $Proxy2.prepareStatement(Unknown Source)
     at com.borland.dx.sql.dataset.Database.createPreparedStatement(Unknown Source)
     at com.borland.dx.sql.dataset.o.a(Unknown Source)
     at com.borland.dx.sql.dataset.o.d(Unknown Source)
     at com.borland.dx.sql.dataset.o.f(Unknown Source)
     at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
     at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
     at com.borland.dx.dataset.StorageDataSet.refresh(Unknown Source)
     at com.borland.dx.sql.dataset.QueryDataSet.refresh(Unknown Source)
     at com.borland.dx.sql.dataset.QueryDataSet.executeQuery(Unknown Source)
     at com.sunopsis.graphical.frame.edit.AbstractEditFrameGridBorland$1.actionPerformed(AbstractEditFrameGridBorland.java:279)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
     at java.awt.Component.processMouseEvent(Component.java:6505)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
     at java.awt.Component.processEvent(Component.java:6270)
     at java.awt.Container.processEvent(Container.java:2229)
     at java.awt.Component.dispatchEventImpl(Component.java:4861)
     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     at java.awt.Component.dispatchEvent(Component.java:4687)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
     at java.awt.Container.dispatchEventImpl(Container.java:2273)
     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     at java.awt.Component.dispatchEvent(Component.java:4687)
     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
     at java.awt.EventQueue.access$000(EventQueue.java:102)
     at java.awt.EventQueue$3.run(EventQueue.java:662)
     at java.awt.EventQueue$3.run(EventQueue.java:660)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
     at java.awt.EventQueue$4.run(EventQueue.java:676)
     at java.awt.EventQueue$4.run(EventQueue.java:674)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Caused by: org.hsqldb.HsqlException: java.lang.ArrayIndexOutOfBoundsException: 2
     at org.hsqldb.error.Error.error(Unknown Source)
     at org.hsqldb.result.Result.newErrorResult(Unknown Source)
     at org.hsqldb.Session.execute(Unknown Source)
     ... 54 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
     at org.hsqldb.ExpressionLike.resolveTypes(Unknown Source)
     at org.hsqldb.ExpressionOp.resolveTypesForCaseWhen(Unknown Source)
     at org.hsqldb.ExpressionOp.resolveTypes(Unknown Source)
     at org.hsqldb.QuerySpecification.resolveExpressionTypes(Unknown Source)
     at org.hsqldb.QuerySpecification.resolveTypesPartOne(Unknown Source)
     at org.hsqldb.QuerySpecification.resolveTypes(Unknown Source)
     at org.hsqldb.QueryExpression.resolve(Unknown Source)
     at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
     at org.hsqldb.ParserCommand.compilePart(Unknown Source)
     at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
     at org.hsqldb.Session.compileStatement(Unknown Source)
     at org.hsqldb.StatementManager.compile(Unknown Source)
     ... 55 more

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points