Solved

# number to decimal conversion

Posted on 2013-10-04
Medium Priority
673 Views
Last Modified: 2013-10-13
Greetings,
I am working orchestrate schema files to import files into SQL Server.
This question has to do with datatypes.

The export (from an ORACLE database) says number() as a datatype.
The orchestrate system allows only decimal(s,p).

What is the maximum allowable scale and precision) to be able to define what the number() limits could be?  or is this basically an integer??
Thank you.
0
Question by:Evan Cutler
• 2
• 2
• 2
• +1
7 Comments

LVL 34

Expert Comment

ID: 39548167
Here is a link to the datatype definition:

http://msdn.microsoft.com/en-us/library/ms187746.aspx

Basically...

decimal(p, s) where p = precision and s = scale
0 <= p <= 38
0 <= s <= p
0

LVL 143

Assisted Solution

Guy Hengel [angelIII / a3] earned 400 total points
ID: 39548172
for oracle (which I think the question is):
http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i22289
... with up to 38 significant digits ...

so it's the same (which is actually defined by the standards...)
0

LVL 9

Author Comment

ID: 39548174
hi.
Thanks.....
I know how to define the datatypes....

my problem is that the inbound datafields are described as number().

I can't send outbound datafield as decimal() due to errors saying "where's the scale and precision?"

What do I use when I don't have this?
Thanks.
0

LVL 143

Expert Comment

ID: 39548197
for "number()" is by default (38,0) ....
not sure if you can override it in your tool
0

LVL 34

Expert Comment

ID: 39548202
You will need to evaluate the data coming in.  Basically you have a maximum of 38 digits to work with and you just need to decide how many need to be on either side of the decimal.  For example, if you're dealing with currency then 6 significant digits to the right of the decimal should be more than enough so use decimal(38,6).  Obviously the more significant digits you use the more space the value will take to store.

hth
0

LVL 35

Accepted Solution

johnsone earned 1600 total points
ID: 39549105
number() is not equivalent to number(38,0).

As per the documentation (http://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements001.htm#sthref118):

The absence of precision and scale designators specifies the maximum range and precision for an Oracle number.

I believe that would make number() equivalent to number(38,38).

You can quite easily prove that with this simple case:

``````create table x (y number);
insert into x values (1.234);
insert into x values (1.2345);
insert into x values (1.23456);
insert into x values (1.234567);
insert into x values (1.2345678);
insert into x values (1.23456789);
insert into x values (1.234567891);
insert into x values (1.2345678901);
insert into x values (1.23456789012);
insert into x values (1.234567890123);
insert into x values (1.2345678901234);
select * from x;
``````

You will see that you get all the decimal values.  If you change the datatype of the table to number(38,0), then run the test case, you will get back all 1s as all the data is converted to number(38,0).
0

LVL 9

Author Closing Comment

ID: 39569294
I had to go this route.
The data coming in changes every time, and I don't want to have to rebuild my solution to accommodate.

ThAnks guys.
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

## Join & Write a Comment Already a member? Login.

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
###### Suggested Courses
Course of the Month14 days, 4 hours left to enroll

#### 600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.