Troubleshooting
Problem
When a reorg table command is issued from a CLI application against a DB2 database server, the application fails with SQL0104N.
Symptom
For example:
Similar entries may be seen in a CLI trace:
SQLGetDiagRecW( fHandleType=SQL_HANDLE_STMT, hHandle=1:1, iRecNumber=1, pszSqlState=&02f0f684, pfNativeError=&02f0f750, pszErrorMsg=&03672b98, cbErrorMsgMax=512, pcbErrorMsg=&02f0f74c )
---> Time elapsed - +9.000000E-006 seconds
( iRowNumber=-1, iColumnNumber=-2 )
SQLGetDiagRecW( pszSqlState="42601", pfNativeError=-104, pszErrorMsg="[IBM][CLI Driver][DB2/SUN64] SQL0104N An unexpected token "test" was found following "reorg table ". Expected tokens may include: "JOIN". SQLSTATE=42601
", pcbErrorMsg=158 )
<--- SQL_SUCCESS Time elapsed - +4.752000E-003 seconds
Cause
REORG command is supported by command line processor, you cannot use the REORG command directly from a CLI application.
Diagnosing The Problem
Test the REORG command from command line, it works successfully.
For example:
db2 "reorg table reorgtest"
DB20000I The REORG command completed successfully.
Resolving The Problem
Use ADMIN_CMD Stored Procedure to run the REORG table command from a CLI application instead of issuing the REORG command directly.
For example:
CALL SYSPROC.ADMIN_CMD ('REORG TABLE test')
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21590305