Using a Here Document for Standard Input Files - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
15.00
Language
English (United States)
Last Update
2018-09-25
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Using a Here Document for Standard Input Files

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
#########################################