MySQL Forums :: Stored Procedures :: Condition was unable to be followed by MySQL.


Advanced Search

Re: Condition was unable to be followed by MySQL.
Posted by: Peter Brawley ()
Date: June 03, 2016 06:08PM

> How do I add stubs that monitor the variables?

Add select statements for them at points where their values would be diagnostic, eg after computing@total, add the stmt

select @total;

> And how do I compute the parameter value?

set @total = (select count(*) from ... );
if @total=0 then
  set @lev=1
elseif @total < 3 then
  set @lv=1
...
end if;

insert into gph_acquiredpeople 
set member_id p_memberid,encoded_mem_id=p_encodeid,date_encoded=now(),level_id=@lev;

update gph_memberstatus set available =0, taken=1 where id_number = p_encodeid;

As it turns out, the logic you show doesn't require PREPARE; just compute @lev and use it in the Insert statement.

BTW, column names should document themselves. If a column is a timestamp or datetime, naming it `date_encoded` misleads whoever is managing the database; timestamp_encoded ot ts_encoded would be better. If it's just a date, set it to curdate(), not to now().

Options: ReplyQuote


Subject Views Written By Posted
Condition was unable to be followed by MySQL. 3151 Rob Bert 06/02/2016 06:36PM
Re: Condition was unable to be followed by MySQL. 335 Peter Brawley 06/02/2016 07:43PM
Re: Condition was unable to be followed by MySQL. 356 Rob Bert 06/02/2016 08:11PM
Re: Condition was unable to be followed by MySQL. 348 Peter Brawley 06/03/2016 06:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.