Solved

Oracle and Numbers (Currency)

Posted on 2012-04-06
4
481 Views
Last Modified: 2012-04-08
I am importing data from a csv that has numbers with currency. I am importing the columns as a number field but once the data is imported it is rounded off..

everything that is 0.50 becomes 1

should i be importing this data as varchar? it is going to be dealing with purely numbers with decimal places, i may need to end up with a number like 91.242879
0
Comment
Question by:gnivkor
4 Comments
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 500 total points
Comment Utility
- you can use the datatype Number with 2 precision such as Number(7,2).

- then when importing format the currency data using to_number as follow:
to_number(replace(x,' '),'L999,999,999.99')
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
What tool are you using to import the data?

By default Oracle numbers can handle decimals without rounding:

SQL> create table tab1(col1 number);

Table created.

SQL> insert into tab1 values(1.23456789);

1 row created.

SQL> select * from tab1;

      COL1
----------
1.23456789

Open in new window

0
 
LVL 29

Expert Comment

by:MikeOM_DBA
Comment Utility
You could use a regular expression in your control file something like this:
...Etc...
numcolx     "REGEXP_REPLACE( :numcolx, '([:ALPHA:]|[,])', '' )".
...Etc...

Open in new window

:p
0
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
Comment Utility
I think, this might be the problem within tool( generally people use excel) to open csv file) itself, unless you specify explicitly oracle won't round it off for you(as mentioned in comment http:a#37816610)

try to format in the tool(assuming excel) to see whether the column is formatted as to specify the nearest integer ..!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now