ROUNDING IN COMPUTE

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Mon, 10 Dec 2007 10:39 am

HELLO GUYS GOOD MORNING, I'M DOING a calculation and I'M with a DOUBT for EXAMPLE: I HAVE the FOLLOWING TABLE: p. VLTITULO/* = 1.0889 1.3496 THEN HE BRINGS a BIG RESULT AI TRIED ROUNDS it to GET the DECIMAL PLACES também BUT HE ROUNDED DOWN to DO so: HE DOES the calculation and ROUND UP BRINGING the TWO DECIMAL PLACES TRIED SO BUT HE BROUGHT DOWN EX: 112.076985032602 AI USED THIS OPTION with the TRUNC TRUNC (p. VLTITULO/1.3496 * 1.0889) calculation and HE BROUGHT (112) MUST GET the TWO DECIMAL PLACES AFTER 112 WOULD BE MORE or LESS THUS 112.07
carlos12
Location: rio

Poston Mon, 10 Dec 2007 10:48 am

Hey Carlos, beleza?

Dude, try to use the round informed q você wants to round in the second decimal place. will there an example..
Code: Select all
SQL> SELECT ROUND(1.523,2) FROM DUAL
  2  /

ROUND(1.523,2)
--------------
          1.52

SQL> SELECT ROUND(1.524,2) FROM DUAL
  2  /

ROUND(1.524,2)
--------------
          1.52

SQL> SELECT ROUND(1.525,2) FROM DUAL
  2  /

ROUND(1.525,2)
--------------
          1.53

SQL> SELECT ROUND(1.526,2) FROM DUAL
  2  /

ROUND(1.526,2)
--------------
          1.53


[]'s
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Mon, 10 Dec 2007 10:52 am

Hello my friend once again giving me a force, man HOW DO I that? I CAN PUT IT THIS WAY: ROUND (P. VLTITULO--AND WHAT I DO NOW?
carlos12
Location: rio

Poston Mon, 10 Dec 2007 10:55 am

I STILL HAVE the calculation INSIDE to BE DONE I DON'T KNOW ROUND (p. VLTITULO/1.3496 * 1.0889) HE BRINGS STILL ROUNDED:(
carlos12
Location: rio

Poston Mon, 10 Dec 2007 10:56 am

THE ROUNDING MUST BE DONE AFTER THE CALCULATION
carlos12
Location: rio

Poston Mon, 10 Dec 2007 10:58 am

The round accepts 2 parameters, the first is the value you want to round, the second is the number of decimal places that you want to ...
for example ...

Code: Select all
   v_RESULTADO := ROUND(v_TOTAL,2);
or
Code: Select all
   v_RESULTADO := ROUND( P.VLTITULO / 10  ,2);
or
Code: Select all
   v_RESULTADO := ROUND( (P.VLTITULO / 10)*0.10  ,2);
[] 's!
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Mon, 10 Dec 2007 11:04 am

POW GUY GAVE MY FRIEND RIGHT NOW THANKS ONCE AGAIN Christian (Tineks) BAD O I'M OPENING ONE MORE TOPIC To SEE IF YOUR KNOWLEDGE Is Easy também BECAUSE I HAVE THIS DOUBT For DAYS A STRONG HUG
carlos12
Location: rio



Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests