标签:roc prepare from int ati count creat select tis
DROP PROCEDURE
IF EXISTS drop_demo_index1;
delimiter //
CREATE PROCEDURE drop_demo_index1 (
IN p_tablename VARCHAR (100),
IN p_idxname VARCHAR (100)
)
BEGIN
DECLARE
str VARCHAR (250) ;
SET @str = concat(
‘drop index ‘,
p_idxname,
‘ on ‘,
p_tablename
) ; SELECT
count(*) INTO @cnt
FROM
information_schema.statistics
WHERE
table_name = p_tablename
AND index_name = p_idxname ;
IF @cnt > 0 THEN
PREPARE stmt
FROM
@str ; EXECUTE stmt ;
END
IF ;
END ;//
delimiter;
CALL drop_demo_index1(‘表名‘,‘索引名‘);
create index 索引 ON 表名(列名);
标签:roc prepare from int ati count creat select tis
原文地址:https://www.cnblogs.com/csk-1/p/10532870.html