CREATE TEMPORARY TABLE MAPPING_TABLE_TEMP
(
T_TABLENAME VARCHAR(50),
T_COLUMNNAME VARCHAR(50),
S_TABLENAME VARCHAR(50),
S_COLUMNNAME VARCHAR(4000),
VERSION_NUMBER INT,
CONSTRAINT_TYPE VARCHAR(100)
);
INSERT INTO MAPPING_TABLE_TEMP (SELECT T_TABLENAME,T_COLUMNNAME,S_TABLENAME,S_COLUMNNAME,VERSION_NUMBER,CONSTRAINT_TYPE FROM mapping_table);
--
get_constraintType : LOOP
IF(MAPPING_TABLE_TEMP.CONSTRAINT_TYPE='PK') THEN
INSERT INTO RULEMAPPING(RULEID,T_TABLENAME,T_COLUMNNAME,S_TABLENAME,S_COLUMNNAME,EXECUTION_FLAG,SAMPLING_PERCENTAGE,RMID,LAST_EXECUTION_DATE,VERSION_NUMBER)
VALUES(
'2',T_TABLENAME,T_COLUMNNAME,S_TABLENAME,S_COLUMNNAME,'',100,'1',CURDATE(),VERSION_NUMBER);
END IF;
END LOOP;
如果我在if条件下将MAPPING_TABLE_TEMP更改为NEW,它会说未知表格' NEW',如果我也删除了新的,那么它会给出未知列' CONSTRAINT_TYPE&# 39;
请帮忙。