number to decimal conversion

Posted on 2013-10-04
Medium Priority
Last Modified: 2013-10-13
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.
Question by:Evan Cutler
  • 2
  • 2
  • 2
  • +1
LVL 34

Expert Comment

by:Brian Crowe
ID: 39548167
Here is a link to the datatype definition:



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

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 400 total points
ID: 39548172
for oracle (which I think the question is):
... with up to 38 significant digits ...

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

Author Comment

by:Evan Cutler
ID: 39548174
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?
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39548197
for "number()" is by default (38,0) ....
not sure if you can override it in your tool
LVL 34

Expert Comment

by:Brian Crowe
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.

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;

Open in new window

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).

Author Closing Comment

by:Evan Cutler
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.

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

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

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…

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.

Join & Ask a Question