RTITLE - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose  

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.

Syntax  

where:

 

Syntax Element

Description

string

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 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" 

or

   .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.

Note: 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 blanks 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 blanks between them (for example .SET RTITLE '' or .SET RTITLE " "), causes BTEQ to use as many characters that fit from the SELECT statement as the title string. This is the SELECT statement for which BTEQ is generating a report. Report titles are generated only in response to a select.

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 nonblank 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 many characters of the SELECT statement that fit, and the page number, formatted as follows:

&DATE||as many characters of SELECT as will fit||Page&PAGE

The SELECT statement in the example refers to the statement for which BTEQ is generating a report. Report titles are generated only in response to a select.

Note: 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  

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
   .logoff
   .exit

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

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

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

or

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