Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Number datatype help?

Re: Number datatype help?

From: CK <c_kettenbach_at_hotmail.com>
Date: Mon, 19 Nov 2007 10:31:21 -0800
Message-ID: <nFk0j.163$4q5.114@nlpi069.nbdc.sbc.com>

> You first number has 8 digits of precision and a scale of 2 so you
> need to declare it as (8,2) rather than (6,2).  A format of (6,2)
> would support only digits to the left of the decimal point

Close but it still accepts 654321.000 and it should not. Any other ideas? Thanks for your help.
~ck

"Mark D Powell" <Mark.Powell_at_eds.com> wrote in message news:9bdd1d64-c093-45ae-b048-c4f46739d47e_at_n20g2000hsh.googlegroups.com...

> On Nov 19, 12:26 pm, "CK" <c_kettenb..._at_hotmail.com> wrote:

>> New to Oracle. How can I declare a variable NUMBER that can be assigned:
>>
>> a. 654321.00
>>
>> b. Not 654321.000
>>
>> c. Not 7654321.00
>>
>> ?
>>
>> I am trying this code, but I am getting precision errors. Any ideas? Is
>> my
>> understanding of precision and scale incorrect? I want a number that can
>> be
>> 6 digits and 2 decimal places. What am I missing here? Thanks!
>>
>> --***********
>>
>> SET SERVEROUTPUT ON
>> SET VERIFY OFF
>> DECLARE
>> v_number NUMBER(6,2) := &sv_number;
>>
>> BEGIN
>> DBMS_OUTPUT.PUT_LINE(v_number);
>>
>> END;
>> /
>>
>> --************
>>
>> Cheers,
>> ~ck
>
> You first number has 8 digits of precision and a scale of 2 so you
> need to declare it as (8,2) rather than (6,2).  A format of (6,2)
> would support only digits to the left of the decimal point.
>
> HTH -- Mark D Powell -- 
Received on Mon Nov 19 2007 - 12:31:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US