If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > problem with stored procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-09-04, 15:10
kfir kfir is offline
Registered User
 
Join Date: Mar 2004
Posts: 13
problem with stored procedures

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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On