PAGELENGTH - Basic Teradata Query

Basic Teradata Query Reference

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


This control enables users to specify the maximum number of lines for report form output.


where the following is true:

Specifies the maximum number of lines on a page.

The value is 55 by default.

The valid range is 1 to 2147483647 (for Workstation).

The valid range is 1 to 2147483407 (for Mainframe).

Usage Notes

Use the PAGELENGTH command to customize page length for different reports or forms.

Use an asterisk (*) to represent a single page with unlimited number of lines. Each query will produce one page with a length equal to the number of lines needed to print that query's entire result set and possibly a header, footer, column titles, and titledashes.

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

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

Example 1 – PAGELENGTH

The following example shows the results of using the PAGELENGTH command to set the maximum page length at 67 lines and at 30 lines for the same select operation:

database workforce;   
.set defaults    
.set format on   
.heading "Pagelength 67"    
.footing "Bottom of Page”   
.set pagelength 67   
select   deptname       
,loc     from     department   
order by deptname    
.format on  
.heading "Pagelength 30"  
.footing "Bottom of Page”    
.pagelength 30    
= 1    
.format off   

BTEQ Response

In response to the first select operation BTEQ formats the results, prints the footer at line 67, and ejects the page:

*** Query completed. 5 rows found. 3 columns returned.
                          Pagelength 67
DeptName         DeptNo   Loc
--------------   ------   ---
Administration      100   NYC
Engineering         500   ATL
Exec Office         300   NYC
Manufacturing       600   CHI
Marketing           700   NYC
(BTEQ counts to line 67)
                          Bottom of Page

In response to the second select operation BTEQ formats the results, prints the footer at line 30, and ejects the page as follows:

*** Query completed. 5 rows found. 3 columns returned.
                           Pagelength 30
DeptName          DeptNo   Loc
--------------    ------   ---
Administration       100   NYC
Engineering          500   ATL
Exec Office          300   NYC
Manufacturing        600   CHI
Marketing            700   NYC
(BTEQ counts to line 30)
                           Bottom of Page

Example 2 – PAGELENGTH instigated by a macro

The Example 1 PAGELENGTH commands in a Teradata SQL macro appear as follows:


or as: