| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Precision Function
no builtin oracle function that i know of. you could "roll your own" function, something like this:
CREATE OR REPLACE FUNCTION get_precision
(an_arg IN NUMBER
)RETURN NUMBER
IS
li PLS_INTEGER;
BEGIN
FOR li IN 0..37 LOOP
IF an_arg = TRUNC(an_arg,li) THEN
EXIT;
END IF;
END LOOP;
this has not been tested, or even compiled, but it might give you some ideas. this algorithm is a bit brute force, i wouldn't be surprised if there were a simpler, more efficient way to get the result you want.
HTH
"Ravi Tata" <Ravi.Tata_at_oracle.com> wrote in message
news:3B0AB7DA.3EFAD4A0_at_oracle.com...
>
> Is there a SQL Function to find the precision of a number ... Ex: If the
> number is 100.00 then the precision should be 1, 100.10 then the
> precision should be .1 , if 100.19 the precision should be 0.01 ... Any
> help is appreciated ..
>
> Ravi
>
Received on Tue May 22 2001 - 21:12:57 CDT
![]() |
![]() |