Symptom
You find the following error in the SAP system log (SM21).
Database error -104 at OPC
> SQL0104N An unexpected token ")" was found following "( VALUES ". Expected tokens may include:
> "<join_type_without_spec> JOIN <join_operand>". SQLSTATE=42601
In the developer work trace, you find the involved statement as the follows:
C *** ERROR in prepareStatement[/bas/749_REL/src/dbs/db6/dbdb6.c, 14309] CON = 1 (BEGIN)
C &+ dsql_db6_open( SQLExtendedPrepare ): [IBM][CLI Driver][DB2/AIX64] SQL0104N An unexpected token ")" was found foll
C &+ owing "( VALUES ". Expected tokens may include: "<join_type_without_spec> JOIN <join_operand>". SQLSTATE=4260
C &+ 1
C &+
C &+ WITH ROUTINE_NAMES AS (
C &+ SELECT *
C &+ FROM SYSIBM.SYSDUMMY1,
C &+ ( VALUES
C &+ ) AS T(ROUTINESCHEMA, SPECIFICNAME, REALSPECIFIC, ACTION) ),
C &+ TIMESTAMP_OFFSET AS (
C &+ SELECT ROUTINE_NAMES.ACTION AS ACTION,
C &+ CASE WHEN ALTER_TIME > (CURRENT TIMESTAMP - 48 HOURS) THEN ALTER_TIME
C &+ ELSE (CURRENT TIMESTAMP - 48 HOURS)
C &+ END AS TIMESTAMP
C &+ FROM SYSCAT.ROUTINES INNER JOIN ROUTINE_NAMES
C &+ ON SYSCAT.ROUTINES.ROUTINESCHEMA = ROUTINE_NAMES.ROUTINESCHEMA AND
C &+ SYSCAT.ROUTINES.SPECIFICNAME = ROUTINE_NAMES.REALSPECIFIC ),
C &+ MSG_CNT_ERROR AS (
C &+ SELECT TIMESTAMP_OFFSET.ACTION, COUNT(*) AS MSG_CNT
C &+ FROM TIMESTAMP_OFFSET INNER JOIN SAPTOOLS.SP_MSG_LOG
C &+ ON SAPTOOLS.SP_MSG_LOG.ACTION = TIMESTAMP_OFFSET.ACTION
C &+ WHERE SAPTOOLS.SP_MSG_LOG.EXEC_TIME >= TIMESTAMP_OFFSET.TIMESTAMP AND
C &+ MSG_TYPE = 3
C &+ GROUP BY TIMESTAMP_OFFSET.ACTION ),
C &+ MSG_CNT_WARN AS (
C &+ SELECT TIMESTAMP_OFFSET.ACTION, COUNT(*) AS MSG_CNT
C &+ FROM TIMESTAMP_OFFSET INNER JOIN SAPTOOLS.SP_MSG_LOG
C &+ ON SAPTOOLS.SP_MSG_LOG.ACTION = TIMESTAMP_OFFSET.ACTION
C &+ WHERE SAPTOOLS.SP_MSG_LOG.EXEC_TIME >= TIMESTAMP_OFFSET.TIMESTAMP AND
C &+ MSG_TYPE = 2
C &+ GROUP BY TIMESTAMP_OFFSET.ACTION )
C &+ SELECT ROUTINE_NAMES.ACTION AS ROUTINENAME,
C &+ TIMESTAMP_OFFSET.TIMESTAMP AS MSG_BEGIN_TIME,
C &+ COALESCE(MSG_CNT_ERROR.MSG_CNT,0) AS ERROR_CNT,
C &+ COALESCE(MSG_CNT_WARN.MSG_CNT,0) AS WARN_CNT
C &+ FROM ( ( ROUTINE_NAMES LEFT OUTER JOIN MSG_CNT_ERROR
C &+ ON ROUTINE_NAMES.ACTION = MSG_CNT_ERROR.ACTION )
C &+ LEFT OUTER JOIN MSG_CNT_WARN
C &+ ON ROUTINE_NAMES.ACTION = MSG_CNT_WARN.ACTION )
C &+ LEFT OUTER JOIN TIMESTAMP_OFFSET
C &+ ON ROUTINE_NAMES.ACTION = TIMESTAMP_OFFSET.ACTION
C &+ ORDER BY ROUTINE_NAMES.ACTION ASC
C &+ cursor type=NO_HOLD, isolation=UR, cc_release=YES, optlevel=5, degree=1, op_type=18, read_only=0
C &+
C &+ ABAP location info 'CL_SQL_STATEMENT==============CP', 500
C &+
C *** ERROR in prepareStatement[/bas/749_REL/src/dbs/db6/dbdb6.c, 14309] (END)
Read more...
Environment
SAP on IBM Db2 for Linux, UNIX, and Windows
Keywords
SQL0104N, An unexpected token, VALUES, JOIN, data collector , KBA , sql0104n , BC-DB-DB6-CCM , CCMS/Database Monitors , BC-DB-DB6 , DB2 Universal Database for Unix / NT , Problem
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.