You cannot use a variable in a DDL .. YOu have to use dynamic sql
An alternative is to drop and ignore the warning if the table does not exists ..
Pseudocode:
Code:
CREATE PROCEDURE DROPT
P1: BEGIN
-- Declare variable
DECLARE v_sqlstate_test CHAR(5);
DECLARE v_sqlcode_test INT;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE SQLCODE INT DEFAULT 0;
DECLARE v_TABLE_NOT_FOUND INT DEFAULT 0;
DECLARE c_TABLE_NOT_FOUND CONDITION FOR SQLSTATE '56098';
DECLARE CONTINUE HANDLER FOR c_TABLE_NOT_FOUND
SET v_TABLE_NOT_FOUND = 1;
DROP TABLE T1 ;
IF (v_TABLE_NOT_FOUND ==1 ) tHEN "GO TO NEXT STEP" ELSE "gO TO NEXT STE"
END IF
END IF;
END P1