I have a stored procedure loading some data from a file using the ADMIN_CMD procedure. When there is any issue regarding the load, a SQLCODE SQL3107W (at least one warning message encountered during load operation - the warning does not affect processing) is always generated. According with the documentation, I should expect a SQL2039W7 return code from ADMIN_CMD, but not error raised. Instead, the handler gets fired and I cannot access the result set from ADMIN_CMD, because the procedure has not been called (SQLSTATE=51030).
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING
SET svMESSAGE_CODE = SQLCODE;
CALL SYSPROC.ADMIN_CMD('LOAD FROM "C:\TEST.TXT" OF DEL MODIFIED BY dateformat="YYYYMMDD" timeformat="HH:MM:SS" coldel| decpt. chardel"" MESSAGES ON SERVER INSERT INTO "SCH.TEST" );
ASSOCIATE RESULT SET LOCATOR (bsLOAD_MESSAGE) WITH PROCEDURE SYSPROC.ADMIN_CMD;
ALLOCATE brLOAD_MESSAGE CURSOR FOR RESULT SET bsLOAD_MESSAGE;
FETCH FROM brLOAD_MESSAGE INTO bvROW_READ_COUNT, bvROW_SKIPPED_COUNT, bvROW_LOADED_COUNT, bvROW_REJECTED_COUNT, bvROW_DELETED_COUNT, bvROW_COMMITTED_COUNT, bvROW_PARTITIONED_COUNT, bvAGENT_INFO_ENTRY_COUNT, bvMSG_RETRIEVAL, bvMSG_REMOVAL;
Any idea? I am using DB2 10.5 in a Windows environment