不能像sqlserver一樣用if not exists或者exists,應該這樣:
DECLARE p_count int;
set p_count=0;
select 1 into p_count FROM basic_Character WHERE AreaName = p_areaName
AND AccountName = p_accountName
AND CharacterName = p_characterName limit 1;
if p_count=1 then
....
else ....
end if;
