Support Article
IIF file shared with SR-A14407 has issue on DDL
SA-19304
Summary
While importing a IIF jar on DB2 system, could see error with sysproc.ADMIN_CMD Call query.
CALL SYSPROC.ADMIN_CMD(?)
Error Messages
The number of host variables in the EXECUTE or OPEN statement is not equal to the number of values required.. SQLCODE=-313, SQLSTATE=07004, DRIVER=4.8.86 SQL Code: -313, SQL State: 07004
Steps to Reproduce
1. Take a system which has database as DB2.
2. Export DADT(Data-Admin-DB-Table) of any table.
3. Change any column in the table to set it to NULL or NOT NULL.(If the column us NULL set it to not NULL or if the column is Not NULL set it to NULL)
4. Re-import the exported DADT previously.
5. Download the generated DDL and see the query.
Root Cause
Description-While importing a jar through Import wizard in Designer Studio, if the database is DB2 and if there are any Alter queries with SET NOT NULL or SET NULL, a query is fired after the alter statements to re-organize the altered table. That query fired 'CALL SYSPROC.ADMIN_CMD' is prepared wrongly.
'CALL SYSPROC.ADMIN_CMD(?)' is wrong. Instead it should contain the table name as well. i.e., 'CALL SYSPROC.ADMIN_CMD(REORG table <schemaname>.<tablename>)'. Developer also figured the same from their DB team and ran the queries manually by giving the table name.
Resolution
Perform the following local-change:
Mention the required table names in the query and run it.
CALL SYSPROC.ADMIN_CMD(REORG table <schemaname>.<tablename>)
A BUG-232994 is also created for the same.
Published February 9, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.