I'm trying to create a store proc that counts how many rows are in the ET table if it exists.
I can trap for table not exists but I can't see to trap for when the table is 'loader locked'.
The error code appears to be 2652 ie CALL Failed.  TPT_GET_TABLE_COUNT:Operation not allowed: TEST.ET_TTU_TEST_DQA is being Loaded.
Below is the temporary table I use, the proc and the call.
FYI. You have to lock the table via a load to be able to test for the error above.
Note: I'm using TD 13.0
CREATE SET GLOBAL TEMPORARY TABLE ERROR_TABLE_COUNT ,FALLBACK , CHECKSUM = DEFAULT, LOG ( TABLE_NAME VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC, TABLE_ROW_COUNT INTEGER) PRIMARY INDEX ( TABLE_NAME ) ON COMMIT DELETE ROWS;
REPLACE PROCEDURE CTLFW_GET_TABLE_COUNT( IN p_DATABASE_NAME VARCHAR(30) -- DATABASE TABLES ARE IN , IN p_TABLE_NAME VARCHAR(30) -- TABLE ,OUT p_TABLE_CNT INTEGER --count of records in table ) --PROC LEVEL LABEL P1:BEGIN