Solved

numbers in oracle

Posted on 2000-05-16
4
728 Views
Last Modified: 2012-05-12
(oracle8i, solaris2.7)
I want to have a money field in my table. So it means I always want the numbers there to have two digits after the point, even if it's 5.00.
How do I do that?
0
Comment
Question by:wabby26
  • 2
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
Mark Geerlings earned 50 total points
Comment Utility
You cannot force Oracle to store non-significant digits in a number column.  If you really think there is value in storing non-significant zeroes, you will have to define the column as varchar2 and do conversions.  It seems much easier to let Oracle store the data in its native, most efficient way, and format the output (in SQL*Plus or whatever client tool you use) in whatever format you wish.
0
 

Author Comment

by:wabby26
Comment Utility
OK, so if I leave it to be a number, and do the translation while using the select command, isn't there any function that can take that number and put it in that format (money format)?
0
 
LVL 34

Expert Comment

by:Mark Geerlings
Comment Utility
You have multiple options.

You could set up a view that does a to_char conversion on the number column(s) then do your select from the view rather than table.

Or, you could set up a function (named to_money for example) then apply that function to the column(s) in your select statements.

In SQL*Plus you can set the column characteristics to the format you want like:
column [column name] format 999,999.99

The view may be the best approach for you, but I don't know what client or fron-end tool you are using - that may influence your options.
0
 

Author Comment

by:wabby26
Comment Utility
10x
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

Suggested Solutions

Title # Comments Views Activity
Value of 0's not appearing. 9 49
levels for reporting 5 48
Export BLOB data from Oracle 10g 4 23
Oracle DATE Column Space 11 40
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
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 explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

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

11 Experts available now in Live!

Get 1:1 Help Now