I'm using mysql5.0
Im using sp, my procedure look like:

CREATE
PROCEDURE `p_get_Pref_id`( IN p_Perf_Name VARCHAR(250) ,
OUT
p_Status INT,
OUT p_Err_Desc VARCHAR(250),
OUT
p_Perf_Id INT )
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE
CONTINUE HANDLER FOR SQLEXCEPTION SET done = 1;

select
min(PERF_ID) into p_Perf_Id from PERFORMER a where a.PERF_NAME_UP =
upper(p_Perf_Name);

IF p_Perf_Id IS Null THEN
insert into
PERFORMER ( PERF_NAME , PERF_NAME_UP, PERF_CREATE_DATE)
values(
p_Perf_Name , upper(p_Perf_Name),NOW());
SELECT LAST_INSERT_ID()
INTO P_PERF_ID;
set p_Status=1;
IF done = 1 THEN
set
p_Status = 2;

END IF;
END IF;


end

my problem is when I
call the procedure in the first time it work fine but after it bring
worng result.
how can I fix it?

thanks