Repeats the previous Teradata SQL request a specified number of times.
where the following is true:
- The number of times to repeat the previous Teradata SQL request.
The valid range is 0 to 2147483647. The default value is 1. If n is 0 (or not specified in the command), BTEQ sets the REPEAT factor to 1.
Use = to execute the previous Teradata SQL request one or more additional times. This command enables the user to specify a Teradata SQL request, view the results, change formatting options, and execute the request again without having to reenter it.
The definition of request is critical to this command. For instance, the following sequence causes only the ET (END TRANSACTION) statement to be submitted 10 more times because BTEQ interprets the ET statement as the last complete request:
BT; select ... ; select ... ; select ... ; ET; = 10
When this request is processed, BTEQ sends only the ETs, not the statements, which causes the DBS to fail the ET requests. The DBS invalidates the nine ET statements and issues the following message to BTEQ, which displays it for the user:
"Failure 3510 Too many END TRANSACTION statements."
To submit the entire transaction ten more times, place the semicolon characters as follows:
BT ;select ... ;select ... ;select ... ;ET; = 10
In this case, because of the placement of the semicolons, BTEQ interprets all statements in the transaction as one multi-statement request.
Differences Between = and REPEAT
- Enter REPEAT before the request to be repeated. Enter = after the request.
- REPEAT specifies the total number of times to submit the following request. = specifies how many more times to resubmit the last request.
- REPEAT can resubmit a request repetitively until the import file is exhausted.
Using the = Command with the COMPILE Command
When the = command is used after the COMPILE command, the = command repeats the COMPILE request one time, regardless of the value of n in the = command.
Applying the = Command
The = command applies to the most recent Teradata SQL request, even if one or more BTEQ commands have occurred after the last Teradata SQL request. Note that this command is most appropriate for the SELECT statement, because it does not affect the contents of the database. Always be careful when using the = command to resubmit a statement that affects the contents of the database.
The = command is not valid in a Teradata SQL macro.
Example 1 – =
The following example returns the selected information first with the default format, then uses = to repeat the request once after setting the SIDETITLES command option to ON, and twice after setting the FORMAT command option to ON:
database Workforce; .defaults .format on select Name DeptNo from Employee order by Name ; .defaults .format on .heading '= 1' .sidetitles on = 1 .defaults .format on .heading '= 2' = 2 .logoff .exit
... Page 1 Name DeptNo ------------ ------ Aguilar J 600 Brangle B 700 Carter J 500 Chin M 100 Clements D 700 Greene W 100 Inglis C 500 Kemper R 600 Leidner P 300 Marston A 500 Moffit H 100 . . (etc) Name Aguilar J DeptNo 600 Name Brangle B DeptNo 700 Name Carter J DeptNo 500 Name Chin M DeptNo 100 Name Clements D DeptNo 700 Name Greene W DeptNo 100 . . . (etc) Name DeptNo ------------ ------ Aguilar J 600 Brangle B 700 Carter J 500 Chin M 100 Clements D 700 Greene W 100 Inglis C 500 Kemper R 600 Leidner P 300 Marston A 500 . . . (etc)
Example 2 – =
To repeat the previous Teradata SQL request once, type: