List:General Discussion« Previous MessageNext Message »
From:Larry Martell Date:February 11 2014 11:14pm
Subject:Conditional in update
View as plain text  
Is there some way I can have a conditional in an update?

I have this update sql (paraphrased):

set LIMIT = sign(LIMIT) * 100 * floor(0.000001 + (sign(LIMIT) * LIMIT
* ratio/100)
where SYMBOL_ID = symbolId
and CLASSTYPE = LimitType
and TYPE_ in ('minClusterPosition', 'maxClusterPosition',
'minProductPosition', 'maxProductPosition', 'minBookPosition',
'maxBookPosition', 'maxShortShares')

(ratio, symbolId, and LimitType all are filled in at run time)

What i want to do is limit (no pun intended) the value LIMIT is set to
to +/-2,147,483,647 - i.e. if the result of (sign(LIMIT) * 100 *
floor(0.000001 + (sign(LIMIT) * LIMIT * ratio/100)) is more or less
then that, I want to set it to +/-2,147,483,647 Can I do this in SQL?

Conditional in updateLarry Martell11 Feb
  • Re: Conditional in updatehsv13 Feb
    • Re: Conditional in updateLarry Martell13 Feb