PAGEBREAK Command | Basic Teradata Query - PAGEBREAK (PB) - Basic Teradata Query

Basic Teradata® Query Reference - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Basic Teradata Query
Release Number
20.00
Published
October 2023
ft:locale
en-US
ft:lastEdition
2025-04-02
dita:mapPath
gxl1691484661681.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
psp1479308573013
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



Shorthand Syntax (Interactive Mode Only)
Command Shorthand
PAGEBREAK PB

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 DEFAULTS command resets PAGEBREAK setting to OFF 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 an 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 PAGEBREAK command in an SQL macro appears as:

ECHO '.SET PAGEBREAK ON 2';