Defining a Schema
Teradata PT requires that the job script describe the structure of the data to be
processed, that is the columns in table rows or fields in file records. This description
is called the schema. Schemas are created using the DEFINE SCHEMA statement.
The value following the keyword SCHEMA in a DEFINE OPERATOR statement identifies the
schema that the operator will use to process job data. Schemas specified in operator
definitions must have been previously defined in the job script. To determine how
many schemas you must define, observe the following guidelines on how and why schemas
are referenced in operator definitions (except standalone operators):
The schema referenced in a producer operator definition describes the structure of
the source data.
The schema referenced in a consumer operator definition describes the structure of
the data that will be loaded into the target. The consumer operator schema can be
coded as SCHEMA * (a deferred schema), which means that it will accept the scheme
of the output data from the producer.
You can use the same schema for multiple operators.
You cannot use multiple schemas within a single operator, except in filter operators,
which use two schemas (input and output).
The column names in a schema definition in a Teradata PT script do not have to match
the actual column names of the target table, but their data types must match exactly.
Note, that when a Teradata PT job is processing character data in the UTF-16 character
set, all CHAR(m) and VARCHAR(n) schema columns will have byte count values m and n, respectively, that are twice the character count values in the corresponding column definitions of the Teradata Database table.
Because of this, m and n must be even numbers.
Note: When using the UTF-16 character set in a job script, the value of n in VARCHAR(n)
and CHAR(n) in the SCHEMA definition must be an even and positive number.
The following is an example of a schema definition:
Figure 10: Example Schema Definition