Re: Conditional in update

2014-02-12 Thread hsv
2014/02/11 18:14 -0500, Larry Martell set LIMIT = sign(LIMIT) * 100 * floor(0.01 + (sign(LIMIT) * LIMIT * ratio/100) The function TRUNCATE can be useful here: set LIMIT = TRUNCATE(LIMIT * ratio + 0.01 * sign(LIMIT), -2) , if it works as advertized. In any case, ABS(LIMIT) = sign(LIMIT)

Re: Conditional in update

2014-02-12 Thread Larry Martell
On Wed, Feb 12, 2014 at 5:35 PM, h...@tbbs.net wrote: 2014/02/11 18:14 -0500, Larry Martell set LIMIT = sign(LIMIT) * 100 * floor(0.01 + (sign(LIMIT) * LIMIT * ratio/100) The function TRUNCATE can be useful here: set LIMIT = TRUNCATE(LIMIT * ratio + 0.01 * sign(LIMIT), -2) , if

Conditional in update

2014-02-11 Thread Larry Martell
Is there some way I can have a conditional in an update? I have this update sql (paraphrased): update LMPROC_LIMITS set LIMIT = sign(LIMIT) * 100 * floor(0.01 + (sign(LIMIT) * LIMIT * ratio/100) where SYMBOL_ID = symbolId and CLASSTYPE = LimitType and TYPE_ in ('minClusterPosition