15.00 - TS_DECOMPRESS - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)
Last Update
2018-09-24

TS_DECOMPRESS

Purpose  

Uncompresses TIME and TIMESTAMP data with or without time zone that the TS_COMPRESS function compressed.

Syntax  

where:

 

Syntax element…

Specifies…

TD_SYSFNLIB

the name of the database where the function is located.

compressed_string

data that was compressed using TS_COMPRESS.

When used as part of the COMPRESS USING or DECOMPRESS USING phrases, this function takes no arguments. For more information about the COMPRESS/DECOMPRESS phrase, see SQL Data Types and Literals.ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Argument Type and Rules

Expressions passed to this function must have a data type of VARBYTE(n), where the maximum supported size (n) is 20.

The input to this function must be the output result of the TS_COMPRESS function.

Result Type

The result data type is td_anytype.

Example  

The following SQL statement creates a TIME column in t_time that compressed when stored and uncompressed when retrieved from storage:

CREATE table t_time(i int, j time(6) compress using td_sysfnlib.ts_compress decompress using td_sysfnlib.ts_decompress);

If you insert the following TIME values into column j:

INSERT into t_time(1, TIME'06:26:44.820000');
INSERT into t_time(2, TIME'10:26:44.820000');

The following SQL statement:

SELECT j from t_time;

returns the 2 uncompressed TIME values that were compressed when the values were inserted in the table t_time.