17.10 - Examples - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

Defining BLOB Data

The following example creates a table that defines a BLOB column named blarge:

CREATE TABLE t1
  (id INTEGER
  ,blarge BLOB(128K));

Inserting BLOB Data

The following example shows a stored procedure that inserts part of a BLOB into one table and the remaining part of the BLOB into another table:

CREATE TABLE LocalData(ld_ID INTEGER, ld_DATA BLOB);
CREATE TABLE GlobalData (gd_ID INTEGER, gd_DATA BLOB);

CREATE PROCEDURE DataSplitter(IN local_ID  INTEGER,
                              IN global_ID INTEGER,
                              IN all_DATA  BLOB)

BEGIN

   INSERT LocalData (local_ID, SUBSTRING(all_DATA FROM 1 FOR 128546));
   INSERT GlobalData (global_ID, SUBSTRING(all_DATA FROM 128547));

END;