Solved

Number Format

Posted on 2016-09-16
1
62 Views
Last Modified: 2016-09-16
I have the following code that will give me the sum of the last hours worked in a 12 month period.
(SELECT sum(prt.hours)
       FROM prod.prtime prt
       WHERE prt.tr_date BETWEEN TRUNC (ADD_MONTHS (SYSDATE, -13), 'MM')  
       AND TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE, -1))+1) ) HOURS_WORKED

I need to have the Hours Worked field formatted to 6 spaces.
I don't need the decimal values, but still need everything to be a total of 6 spaces.

Currently, I'm getting values like:
1961.61
1984
1762.1
672
80

I need to have the results look like:
1961
1984
1762
672
0
Comment
Question by:metalteck
1 Comment
 
LVL 35

Accepted Solution

by:
johnsone earned 500 total points
ID: 41802160
rpad(trunc(sum(prt.hours)), 6)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and theā€¦
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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.

713 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