A few simple syntax rules are important to note when creating Teradata PT job scripts:
- Attribute names are case-insensitive.
- Most attribute values are case-insensitive. However, attribute values, such as file names and directory names, may be case-sensitive depending on the platform.
- Non-attribute object parameters, such as the syntax elements in a DEFINE JOB statement, are case-sensitive.
- Defining Objects – Every Teradata PT object must be defined before it can be referenced anywhere in the Teradata PT job script.
- Keyword Restrictions– Do not use Teradata PT reserved keywords, such as OPERATOR, SOURCE, DESCRIPTION in your job scripts as identifiers for column names, attributes, or other values. A complete list of these reserved keywords is provided in Teradata Parallel Transporter Reference (B035-2436).
- Use of VARCHAR and INTEGER - Use of the keywords VARCHAR and INTEGER to declare the attributes of an operator, as follows:
VARCHAR and INTEGER are required in a job script:
- In a DEFINE SCHEMA statement, which may also require other keywords for data type specification.
- In a DEFINE OPERATOR statement when an attribute is declared but no attribute value is specified.
VARCHAR and INTEGER are not required in a job script:
- In a DEFINE OPERATOR statement, if the attribute declaration includes a value.VARCHAR and INTEGER keywords are unnecessary when assigning a value to an attribute in an APPLY statement because the data type of the attribute is specified when the operator is defined.
Quotation Marks – Use the following rules when using quotes:
- Character string literals must be enclosed in single quotes.
- Values for VARCHAR attributes must be enclosed in single quotes, and embedded quotes must be escaped with two consecutive single quotes.
- Values for INTEGER attributes require no quotes.
SQL Notation – SQL statements that span multiple lines must have a space or tab character between the last character of a line and the first character in the next line. If not, the two lines are processed as if there is no line break, which inadvertently joins the two character strings, resulting in either an error or the processing of an unintended SQL statement.
For example, the following code would produce an error if no space or tab was added between “FINAL” and “INSTANCE” because the Teradata Database would see the invalid keyword FINALINSTANCE:
('CREATE TYPE INSV_INTEGER AS INTEGER FINAL INSTANCE METHOD IntegerToFloat() RETURNS FLOAT LANGUAGE C DETERMINISTIC PARAMETER STYLE TD_GENERAL NO SQL RETURNS NULL ON NULL INPUT;')
Using Comments - Teradata PT supports the use of C-style comments anywhere in a Teradata PT job script; for example: