If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Packed decimal UPD?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-16-05, 17:45
PanamaMike PanamaMike is offline
Registered User
 
Join Date: Jan 2004
Location: Austin
Posts: 62
Packed decimal UPD?

Does anyone know how to handle packed decimal characters or values in DB2? Is it best just to have it converted to ASCII before loading it into a table?
I only ask this question because the customer is concerned with performance and data volume. Currently by using packed decimal they say 2x in space.

Mike
Reply With Quote
  #2 (permalink)  
Old 12-16-05, 20:00
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
A decimal column is stored as packed decimal ((n+1)/2). Numeric is the equivilent to decimal data type.

Date (4 bytes), time (4 bytes), and timestamp (10 bytes) columns are stored similar to packed decimal, but without the sign in last half byte (n/2). This is true even though they are returned to programs as char data types and must be input as char data types.

An integer is stored as a full word binary (4 bytes), and smallint is stored as half-word binary (2 bytes).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 12-19-05, 14:54
PanamaMike PanamaMike is offline
Registered User
 
Join Date: Jan 2004
Location: Austin
Posts: 62
Space is saved

Marcus_A,

From your explaination it sounds like the saved data will not eat up extra space. But, what if I want to send the data to another system in the same format
it came in? I.e. the packed decimal without having to do a conversion?

Is this possible?

Mike
Reply With Quote
  #4 (permalink)  
Old 12-19-05, 16:59
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
I am not sure I know what you mean by "other system". Db2 stores the data in "packed' format. In some cases like date, time, and timestamp, the data is returned to the applicaiton program in character format with the extra dashes, slashes, colons, etc. When a program puts that data into another database (DB2 or otherwise) it will store it as packed.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On