This commit is contained in:
yitonglei 2022-07-14 12:54:22 +08:00
parent 3b0e930aa9
commit 455f5b71d9
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
DROP PROCEDURE IF EXISTS del_idx;
create procedure del_idx(IN p_tablename varchar(200), IN p_idxname VARCHAR(200))
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 ;
call del_idx('sys_user_token','user_id');