Search code examples
type-conversionvarcharnetezzaexponential

Convert Exponential to Varchar in Netezza


I have this 12241089001 value read as 1.2241089001E10 in Netezza. Actually the data type is Varchar. How can this read as exponential? When I convert 1.2241089001E10 into Varchar, it's only cut the E10. Example : 1.2241089001. How to save this value into 12241089001?


Solution

  • A direct CAST from VARCHAR to FLOAT or NUMERIC should do the trick.

    TESTDB.ADMIN(ADMIN)=> select '1.2241089001E10'::float;
      ?COLUMN?
    -------------
     12241089001
    (1 row)
    
    TESTDB.ADMIN(ADMIN)=> select '1.2241089001E10'::numeric(38,10);
            ?COLUMN?
    ------------------------
     12241089001.0000000000
    (1 row)