Solved

Unexpected data returned when using the TO_CHAR function

Posted on 2015-01-07
3
242 Views
Last Modified: 2015-01-08
Gurus,

I'm getting unexpected data returned when using the TO_CHAR function.

Statement:
select distinct
  TO_CHAR(SPECIAL_CHAR('$'||PRSPRSC/100,'fm99999.00'))
 from PRS,ART
      where prsartkeyi = artkeyi and artanrc = 23901;

Result: $.5
Expected Result $0.50

How do I fix this?
0
Comment
Question by:xbox360dp
  • 2
3 Comments
 
LVL 73

Expert Comment

by:sdstuber
ID: 40536696
what does your SPECIAL_CHAR function do?
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 250 total points
ID: 40536703
I don't have your tables, data or function,
but to illustrate how TO_CHAR can be used for format a value into monetary form

SELECT DISTINCT TO_CHAR((prsprsc / 100), 'fm$99999.00')
  FROM (select 50 prsprsc from dual)
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 40536753
One tweak to the above example to add the 0 to the left of the decimal:
'fm$99990.00'

I'm guessing that it is  SPECIAL_CHAR that is messing with your format mask.
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

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…
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 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…
Via a live example, show how to take different types of Oracle backups using RMAN.

743 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

15 Experts available now in Live!

Get 1:1 Help Now