TPT scripting Language and
Syntax rules:
TPT
uses an SQL-like scripting language to define extract, updating, and load
functions in a job script.
All
Teradata PT operators use the same language.
- Case sensitivity syntax:
- Attribute Names (Ex: TDPID) are case insenstive. TDPID and tdpID both mean the same
- Most of Attribute Values (Ex: 'GT11_loadoper_privatelog' in above example ) are case insensitive , but certain things like filename, directory names can be case sensitive depending upon the platform(Ex: Unix is case Senstive. Files 'myfile.txt' and 'MYFILE.txt' both are different.
- Non-attribute object parameters, such as the syntax elements in a DEFINE JOB statement, are case-sensitive.
- Defining Objects:
- Objects should be defined before they are used.
- Keywords Restrictions:
- We should not use TPT keywords like SCHEMA, OPERATOR as the identifiers for column names, attributes and other values.
- Keywords INTEGER and VARCHAR are used to declare the
attributes of the operators:
ex:
VARCHAR PrivateLogName
= 'GT11_loadoper_privatelog',
INTEGER MaxSessions
= 32,
INTEGER MinSessions
= 1,
VARCHAR and INTEGER are mandatory required when an attribute if
declared but attribute value is not specified.
However if the attribute declaration includes values then we
don’t need to write VARCHAR and INTEGER..
This means instead of the above we could have just written as
follows:
PrivateLogName =
'GT11_loadoper_privatelog',
MaxSessions = 32,
INTEGER MinSessions
= 1,
This is allowed because we are providing the attribute values
along with the declarations.
- Quotation Marks
- 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.
Ex:PrivateLogName = 'GT11_loadoper_privatelog',
- Values for INTEGER attributes require no quotes.
Ex: INTEGER
MinSessions = 1,
- SQL notation:
- IF SQL statements span multiple lines there should be a space or a tab character between the last character of the line and the 1st character of the next line.
If not provided the it joins the two character strings,
resulting in either an error or the processing of an unintended SQL statement.
Ex:
'CREATE TYPE INSV_INTEGER AS INTEGER FINAL
INSTANCE METHOD IntegerToFloat()
In above example
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.
- Comments
- TPT supports C- style comments. /* */
No comments:
Post a Comment