MySQL Forums
Forum List  »  Stored Procedures

Re: Stored Procedure .. IF statement condition problem
Posted by: Rick James
Date: March 16, 2013 09:48PM

You can construct a SELECT, PREPARE it, and EXECUTE it.
In the construction of the SELECT, you can CONCAT a string such as "<=" in the middle of an expression:

... CONCAT("SELECT ... WHERE CalculatedPercent_val", ValidationOperator_val, " AcceptableStats_val")

But that will work only if you get CalculatedPercent_val once, not from the row with the values. In that case, consider:
WHERE CASE
        WHEN ValidationOperator_val = '>=' THEN CalculatedPercent_val >= AcceptableStats_val
        WHEN ValidationOperator_val = '<=' THEN CalculatedPercent_val <= AcceptableStats_val
     END

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Stored Procedure .. IF statement condition problem
1339
March 16, 2013 09:48PM


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.