Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Unexpected data returned when using the TO_CHAR function

Posted on 2015-01-07
3
Medium Priority
?
274 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 74

Expert Comment

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

Assisted Solution

by:sdstuber
sdstuber earned 1000 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 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
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.
Suggested Courses

772 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