Topic: select CEILING FLOOR TRUNC
Earlier asked concerning a rounding off in request, there was one more question.
There are tables which are responsible for the prices.
ID, NAME, ID_STATUS, ID_ROUNDING
Business wanted that one prices , others , for this purpose I added ID_ROUNDING a field which defines as the price
1-to the nearest the whole
2-to the nearest smaller whole
3-without a rounding off
There is a procedure of formation of a price, piece SQL:
select A.ID_MODEL, B.NAME_MODEL; case (:ID_ROUNDING) when 1 then ceiling (P.CENA) when 3 then trunc (P.CENA, 2) when 2 then floor (P.CENA) end PRICE_ from STOREHOUSE A join ID_MODEL B on A.ID_MODEL = B.ID join PRICE P on P.ID_MODEL = A.ID_MODEL and P.STATUS = 1 and P.ID_PRICE =:ID_PRICE
Question, ID_ROUNDING to transfer in procedure from the client, or it is possible so?
case (select ID_ROUNDING from cena where id =:ID_PRICE)
Price at one specific price ( ID_PRICE ).
Probably there is in your judgement other candidate solution?
In advance thanks.