Solved

Unexpected data returned when using the TO_CHAR function

Posted on 2015-01-07
3
251 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 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.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

856 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