File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wildcards in Oracle to_char format string

 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an Oracle database and I'm doing this:


If I use that statement and there is a credit limit over $1,000,000.00, I will get hash marks in the result. I know I can add another "9" to the format, but is there a way to give a wildcard in the format string so that it can handle as large a number as I throw at it?

Thanks
 
chris webster
Bartender
Pie
Posts: 2369
31
Linux Oracle Postgres Database Python Scala
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easiest thing is simply to make the format string long enough to cover any value, because Oracle will only use the format elements it needs for a given value. For example:


This returns $1,234,567.89 for banker_sal, and $12,345.00 for programmer_sal.

But remember that you can also use a format like "L999G999G999G999D99" to allow Oracle to use local language settings for currency (L), group separator (G) and decimal separator(D):


This returns £1,234,567.89 for banker_sal, and £12,345.00 for programmer_sal on my system, because I'm using UK settings.

See Oracle 11g docs on TO_CHAR for more format examples.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic