Solved

Unexpected data returned when using the TO_CHAR function

Posted on 2015-01-07
3
256 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
[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
3 Comments
 
LVL 74

Expert Comment

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

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 77

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

Industry Leaders: 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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

728 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