Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Austin
    Posts
    62

    Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    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

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •