RTITLE - Basic Teradata Query

Basic Teradata Query Reference

Basic Teradata Query
Release Number
May 2017
English (United States)
Last Update
Product Category
Teradata Tools and Utilities


Specifies a title that appears at the top of each page of a report. Titles specified by the RTITLE command automatically include the date and page number.


where the following is true:

Text for the title

The text string can contain a maximum of 253 characters, including line separator characters, to describe up to 10 lines.

Usage Notes

The RTITLE command and the HEADING command are alternate versions of the same command. They both specify the top ten lines on each page of a report. If both commands are used, the most recent one overrides the earlier one.

The RTITLE command automatically includes the page number, and the date in YY/MM/DD format. (When using the HEADING command, include the &PAGE and the &DATE substitution values in the header string to place the page numbers and date in the header.)

It is recommended not to use special characters within the string as they might be interpreted differently by different output devices. It might be necessary to modify a script that uses special characters to route the output to another device.

If the string has an apostrophe (single quote) character, use the second form of the RTITLE command (the one with quotes as delimiters) or double the apostrophe. For example:

.SET RTITLE "December's Results"


.SET RTITLE 'December''s Results' 

If the string does not have an apostrophe, the two forms of the RTITLE command are the same.

The RTITLE command is valid in a Teradata SQL macro.

Formatting Headings

There are two types of characters to control heading formats:

Control Characters Result
Double slashes (//) Breaks the line, and begins a new line.
Solid vertical bars (||) Separates the line into sections.

Breaking a Line

To break a header line and begin a new line of header text, insert a pair of slashes (//) at the specified break point. Up to nine line breaks (10 header lines maximum) are valid within a HEADING command.

Separating a Line into Sections

To separate a header line into as many as three sections, insert a pair of solid vertical lines at the specified separation points. Up to three sections (two pairs of vertical bar separators) can be created for each line of the header.

Setting Description Results
Enter a header with no separator characters. The line is one section. The header is centered.
Enter one set of separator characters. The line is separated into two sections. The first part of the line is left-justified, and the second part of the line is centered.
Enter two sets of separator characters. The line is separated into three sections. The first part of the line is left-justified, the second part of the line is centered, and the third part of the line is right-justified.
Also, a pair of split vertical bars can be used as a separator character.

When specifying more than two pairs of vertical bar separator characters, BTEQ responds with the following result:

System Type Result
mainframe-attached BTEQ interprets the additional characters as header text, and issues a warning that the limit of two pairs of vertical bar separator characters has been exceeded.
workstation-attached BTEQ truncates any additional text including the extra (||) or 
(//) from the header.

For example, in a mainframe-attached system the following title string:

.SET RTITLE '||Confidential Report||Part Two|| Page '

returns the following undesirable title:

90/08/25   Confidential Report   Part Two||Page 2

Blank Title Lines

Entering an RTITLE command with one or more spaces as the title string (for example .SET RTITLE' ' or .SET RTITLE" "), causes BTEQ to generate a blank title.

Two Apostrophes

Using a RTITLE command with two apostrophes or quotation marks with no spaces between them (for example .SET RTITLE '' or .SET RTITLE " "), causes BTEQ to use as much of the SQL request text that will fit for the title string.

Title String Wider than Page Width

Specifying a title string that is wider than the page width, causes BTEQ to truncate from the right until the title fits on the page. Note that a title can be continued from one line to the next by including a dash character (-) as the last nonspace character of the line to be continued.

Default Headings and Titles

If the RTITLE command is not used to specify a title, or the HEADING command to specify a header, the default one-line title or header includes the date, as much of the SQL request text that will fit, and the page number, formatted as follows:

&DATE||as much SQL request text as can fit here||Page&PAGE

The RECORDMODE command can be used in a Teradata SQL macro.

An ECHO statement can be used within a Teradata SQL macro to have BTEQ issue the RECORDMODE command.

The FORMAT setting must be ON for the RTITLE setting to have any effect on formatting report form output.

A report title set during a session remains in effect until another RTITLE, HEADING, or DEFAULT command is used.

Example 1 – RTITLE

The following example uses Rtitle On as the title string:

database workforce;
.set defaults on
.set format on
.set rtitle 'Rtitle On'
select * from department;
.set defaults
.set format off

BTEQ Response

*** Query completed. 5 rows found. 4 columns returned.   
90/08/01                Rtitle On                  Page 1
DeptNo  DeptName         Loc  MgrNo
------  --------------   ---  -----
   500  Engineering      ATL  10012
   700  Marketing        NYC  10021
   300  Exec Office      NYC  10018
   600  Manufacturing    CHI  10007
   10 0  Administration   NYC  10011

Example 2 – RTITLE instigated by a macro

The Example 1 RTITLE command in a Teradata SQL macro appears as:

ECHO '.SET RTITLE ''a//b//c'' ';


ECHO '.SET RTITLE "a//b//c"';