PAGEBREAK - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.20
Published
October 2018
Language
English (United States)
Last Update
2020-02-20
dita:mapPath
kil1527114222313.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose

This control enables users to specify whether a page eject is to be done whenever values for one or more specified columns change.

Syntax



where the following is true:

n
A list of left to right ordered column numbers that indicates at which columns a page break is to occur. Multiple numbers must be separated with either a comma (preferably) or a space character.

The value of n can range from 1 to 2048.

Usage Notes

If more than one column is specified, BTEQ ejects a page when the value of any specified column changes. If a column is not sorted and the column appears in the list of pagebreak column numbers, each line can appear on a separate page.

When using the FOLDLINE command with the PAGEBREAK command, set the pagebreak column number to break on the first folded line (as set with the FOLDLINE command), as in the following example:

.SET PAGEBREAK ON 1;
.SET FOLDLINE ON 1, 2, 3;

If the pagebreak column on the PAGEBREAK command does not occur on the first folded line, BTEQ splits the rest of the row onto the next page.

If the PAGEBREAK command is not specified, the values are OFF and ALL by default. If the PAGEBREAK command is used and ON or OFF is not specified, BTEQ sets PAGEBREAK to ON ALL.

The FORMAT setting must also be ON for a PAGEBREAK setting of ON to have any effect on formatting report form output.

The PAGEBREAK setting only affects the output for Field Mode, not Record Mode, Indicator Mode, or Multipart Indicator Mode.

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

When using Mainframe BTEQ interactively on an intelligent terminal, each generated page break may also cause the screen to be cleared.

Example 1 – PAGEBREAK

The following example uses the PAGEGREAK command to begin a new page when the value of column 2 changes:

database workforce;   
.set defaults   
.set format on    
.set pagebreak on 2    
.heading "Pagebreak on 2"    
select   Name         
,Sex     from     employee    
order by sex    
;    
.defaults    
.format off   
.logoff    
.exit

BTEQ Response

BTEQ returns the following two-page response:

Page 1

*** Query completed. 21 rows found. 2 columns returned.
Pagebreak on 2
Name          Sex
-----------   ---
Newman P      F
Smith T       F
Chin M        F
Moffit H      F
Regan R       F
Leidner P     F
Brangle B     F
Marston A     F
Phan A        F

Page 2

Pagebreak on 2
Name         Sex
----------   ---
Peterson J   M
Kemper R     M
Inglis C     M
Carter J     M
Aguilar J    M
Greene W     M
Watson L     M
Clements D   M
Omura H      M
Smith T      M
Russell S    M
Reed C       M

Example 2 – PAGEBREAK instigated by a macro

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

ECHO '.SET PAGEBREAK ON 2';