Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to retrieve DECIMAL value from a DB2 Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Mar 23, 2010 8:21 pm    Post subject: How to retrieve DECIMAL value from a DB2 Table
Reply with quote

Dear Experts,

I have 2 Fields with datatype DECIMAL shown as below in my DB2 table.

COLNAME COLTYPE LENGTH SCALE
------- -------- ------ ------
QTY1 DECIMAL 15 3
QTY2 DECIMAL 15 2

Code:
Values in these columns looks like
------------------  ------------------
     -93058000.000        -99160692.50
       -100000.000          -106557.94
        -54000.000           -54183.33
      -4403000.000         -4691746.32
      -2489000.000         -2652227.25
        -50000.000           -54261.84


When I retrieve the columns as it as, they are displyed as NULL and junk values in my output report.

How to write a SELECT Query to retrieve the values as it is as shown above. i.e converting them into CHAR.

Please suggest ..
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Mar 23, 2010 9:02 pm    Post subject:
Reply with quote

When I retrieve the columns as it as, they are displyed as NULL and junk values in my output report.

How to write a SELECT Query to retrieve the values as it is as shown above. i.e converting them into CHAR.


What are you using to select the data for the report?

Maybe that "JUNK VALUES" is packed decimal values?
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Mar 23, 2010 11:09 pm    Post subject:
Reply with quote

Hi Crag,

I used the function CHAR(QTY1) and CHAR(QTY2). and got the outputs as expected. bu leading Zeroes.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 23, 2010 11:14 pm    Post subject:
Reply with quote

Hello,

Does this mean that all is well or is there still something that needs help?

Quote:
bu leading Zeroes.

icon_confused.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us