Solved

numbers in oracle

Posted on 2000-05-16
4
733 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
[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
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 50 total points
ID: 2815048
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
ID: 2818144
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 35

Expert Comment

by:Mark Geerlings
ID: 2818346
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
ID: 2819215
10x
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

763 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