1

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
And
ID_PRICE,ID_MODEL,PRICE,DATE_,ID_USER,ID_STATUS
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.

2

Re: select CEILING FLOOR TRUNC

Sashaua wrote:

which defines as the price

. Say aloud for check.
"As the price is approximated"
"As the price should be approximated"
About the rounding off, downwards or upwards. In my opinion, this domestic concern of office. Wants so, or wants . To produce in procedures or the code variants are a ball of developers. For example, I so had a good time in 1991, when produced variants of count of the salary on  where to scatter copecks - all equally, to that who earned less, to that who earned more, etc.
So, generally  - to take from the table on the client, and then to stick in request, or directly in request from the table...
Here only
case (select ID_ROUNDING from cena where id =:ID_PRICE)
Is delirium, it is better to thrust table CENA in  with PRICE. Or it should be in PRICE. Or still where.

3

Re: select CEILING FLOOR TRUNC

Everything is Somehow fresh, and how favourite by experts in marketing 99.95? And how it is multiple to 5 roubles?
And how about to look "how much we there at this  last month were going to ship?"
I prefer everything that approximated, there and then near and to save, differently nonconventional joys of a flesh are guaranteed. After a rounding off to take for the further calculations only saved explicitly given.

4

Re: select CEILING FLOOR TRUNC

kdv wrote:

it is passed...
. Say aloud for check.

it is better to ask a question on correspondence: "that does" or "that    "