When to Use a Here Document for Standard Input Files | Basic Teradata Query - Using a Here Document for Standard Input Files - Basic Teradata Query

Basic Teradata® Query Reference

Product
Basic Teradata Query
Release Number
17.10
Published
February 2022
Language
English (United States)
Last Update
2022-02-03
dita:mapPath
nnw1608578382132.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

In scenarios where environment variables need to be used as part of the BTEQ script, a Here document, which can be used to specify a string literal in a command-line shell, is a possible option.

The following example outlines a UNIX script as a Here document.

#!/bin/sh
#########################################
bteq <<EOI
export DATADIR=/datasvc/data
.LOGON mydbs/myid,mypw;
.EXPORT REPORT FILE=$DATADIR/output
SELECT * from table_name;
.EXPORT RESET
.LOGOFF
.EXIT
EOI
#########################################