Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Oracle and Numbers (Currency)

Posted on 2012-04-06
4
Medium Priority
?
497 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 2000 total points
ID: 37816543
- 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 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37816610
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
ID: 37816889
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
ID: 37817004
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

618 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