-- 判断 afterColumnName 是否存在该表内,并赋值给afterColumnNameExists , 不存在结束存储过程并抛出异常 | Determine whether afterColumnName exists in the table, if not end the stored procedure and throw an exception
IF(afterColumnNameISNOTNULL)THEN
SET@afterColumnNameExists=(
SELECTcolumn_name
FROMinformation_schema.columns
WHEREtable_schema=DATABASE()
ANDtable_name=tableName
ANDcolumn_name=afterColumnName
);
IF(@afterColumnNameExistsISNULL)THEN
SIGNALSQLSTATE'02000'
SETMESSAGE_TEXT='The afterColumnName does not exist in the table';
-- 判断 afterColumnName 入参是否 有值, 如果有值则拼接 afterColumnName 和 columnName 之间的关系 | Determine whether afterColumnName parameter has a value. If there is a value, the relationship between afterColumnName and columnName is spliced