Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Fri, 04 Feb 2005 @ 13:59:49 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Workarounds for Decimal18+
From:   Geoffrey Rommel

  If you mean 18 digits before the decimal AND 7 after (We would refer to it as Decimal(25,7)) then you are correct that it can not be represented in a Teradata data type.  

If you do need decimal(25,7), one possibility is to store the number in two separate columns and do the "math" yourself. For instance, you might have two columns like this:

     sales_integer_part     decimal(18,0)
     sales_fractional_part  decimal(7,0)

or maybe

     sales_part_1    decimal(13,0)
     sales_part_2    decimal(12,7)

To print it, you would do something like this (untested):

     sales_integer_part (format 'Z(18)9.') || sales_fractional_part (format '9(7)')

To add or subtract, you would have to add part_2, carry, and add part_1. A UDF would make this *relatively* easy to do.

Multiplication and division are left as an exercise for the reader. ;-)

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023