How do roundup in to a specific number in Oracle SQL? -
- 501--> 588
- 588--> 588
- 589--> 688
i'm going assume want new number 12 less next 100 (so: -12, 88, 188, 288, etc).
so you'd first off, add 12 number, divide 100. provide number decimals can find ceiling value for. need multiply 100 , subtract 12. so:
with sample_data (select -12 num dual union select -11 num dual union select 88 num dual union select 89 num dual union select 173 num dual union select 189 num dual union select 501 num dual union select 588 num dual union select 589 num dual) select num, ceil((num + 12)/100)*100 -12 new_num sample_data; num new_num ---------- ---------- -12 -12 -11 88 88 88 89 188 173 188 189 288 501 588 588 588 589 688
Comments
Post a Comment