alter PROCEDURE p_AddArtisType (isAdd int,aId varchar(10),tIds varchar(500))
BEGIN
if isAdd=1 then
if tIds!='' then
set @updatesql =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext from @updatesql;
execute sqltext;
end if;
else
delete from artiststype where AId=aId;
if tIds!='' then
set @updatesql1 =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext1 from @updatesql1;
execute sqltext1;
end if;
end if;
END;
BEGIN
if isAdd=1 then
if tIds!='' then
set @updatesql =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext from @updatesql;
execute sqltext;
end if;
else
delete from artiststype where AId=aId;
if tIds!='' then
set @updatesql1 =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext1 from @updatesql1;
execute sqltext1;
end if;
end if;
END;
BEGIN
if isAdd=1 then' at line 1错误信息,好不明显
DROP PROCEDURE IF EXISTS p_AddArtisType$$
CREATE PROCEDURE p_AddArtisType (isAdd INT,aId VARCHAR(10),tIds VARCHAR(500))
BEGIN
IF isAdd=1 THEN
IF tIds!='' THEN
SET @updatesql =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext FROM @updatesql;
EXECUTE sqltext;
END IF;
ELSE
DELETE FROM artiststype WHERE AId=aId;
IF tIds!='' THEN
SET @updatesql1 =CONCAT('select ',aId,',ID,FullID,FullName into artiststype(AId,TId,IdPath,NamePath) from t_part_info where ID in(',tIds,')');
PREPARE sqltext1 FROM @updatesql1;
EXECUTE sqltext1;
END IF;
END IF;
END$$
DELIMITER ;