how compressing a character field value ?

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Enthusiast

how compressing a character field value ?

Hello , 

 

I need to compress the value of some character column like : ===============> to have this => , is there any function in teradata that does this ? if now is there a way to do this in a fairly simple manner? , thank you.

 

 


Accepted Solutions
Senior Apprentice

Re: how compressing a character field value ?

Hi,

 

If you use 'compression' in TD then when the raw data value is '=====================>'  it could be stored as '=>' but when retrieved back to an application it will be returned as '=====================>'.

 

This can only be done using Algorithmic Compression (ALC) and you would have to write your own code (C,C++) (start with this manual page https://info.teradata.com/HTMLPubs/DB_TTU_15_10/index.html#page/SQL_Reference/B035_1144_151K/compres...)

 

If you want to permanently change '=====================>'  to '=>' and therefore return '=>' to an application then this is not (in TD terms) compression. You could use a REPLACE function during your load process.

 

HTH

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
1 ACCEPTED SOLUTION
2 REPLIES
Senior Apprentice

Re: how compressing a character field value ?

Hi,

 

If you use 'compression' in TD then when the raw data value is '=====================>'  it could be stored as '=>' but when retrieved back to an application it will be returned as '=====================>'.

 

This can only be done using Algorithmic Compression (ALC) and you would have to write your own code (C,C++) (start with this manual page https://info.teradata.com/HTMLPubs/DB_TTU_15_10/index.html#page/SQL_Reference/B035_1144_151K/compres...)

 

If you want to permanently change '=====================>'  to '=>' and therefore return '=>' to an application then this is not (in TD terms) compression. You could use a REPLACE function during your load process.

 

HTH

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com

Re: how compressing a character field value ?

In your transformation SQL, use;

SEL ...... , '=' || TRIM(LEADING '=' FROM YourCharField) AS TrimmedField ,.....

Or use the newer TD_SYSFNLIB.LTRIM(YourCharField,'=')

Teradata Master Frank