USING Request Modifier - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

Defines one or more variable parameter names used to import data to Teradata Database from a client system or to export data from Teradata Database to a client system. Also specifies how imported or exported LOB data is to be handled.

where:

 

Syntax Element …

Specifies …

using_variable_name

the name of a USING variable that is to be referenced as a parameter in the SQL request associated with the modifier.

Each name specified must be unique.

During processing, each using_variable_name in the SQL request is replaced by a constant value read from the client application.

data_type

the data type of the constant value substituted for using_variable_name.

UDT types are not supported directly. See “USING Support for UDTs” on page 513 for details and information about conversion workarounds.

This can be used to set a default value.

See SQL Data Types and Literals for a list of data types.

data_type_attribute

one of the data type attributes listed below.

The only data type attributes that affect the handling of values imported by USING are the following:

  • CASESPECIFIC
  • NOT CASESPECIFIC
  • UPPERCASE
  • The server character set attribute (for example CHARACTER SET LATIN) cannot be part of data_type_attribute.

    Type attributes are Teradata extensions to the ANSI SQL:2011 standard.

    AS DEFERRED

    that LOB data is to be sent to Teradata Database from the client application when it is elicited, and separately from other row data.

    This option is only valid for LOB data.

    See “USING Support for Large Objects” on page 515 for more information.

    BY NAME

    to interpret the data in the USING row as a client file name. When the system detects the BY NAME option following AS DEFERRED, the following events occur in the order indicated:

    1 Teradata Database sends the file name back to the client.

    2 The client opens the file.

    3 The client sends the data in the file to Teradata Database.

    AS LOCATOR

    that the client application passes a locator for the LOB, generated from a previous SELECT request for the session, to Teradata Database.

    This option is only valid for LOB data.

    See “USING Support for Large Objects” on page 515 for more information.

    SQL_request

    the SQL request with which the USING request modifier is associated.

    This can be a multistatement request, any non-DDL single‑statement request, or an explicit transaction.

    You can pass the value for n in a TOP n operator in an SQL request by specifying a USING‑defined parameter. See “Example 11USING Request Modifier with TOP Operator” on page 529.

    All USING variable names in the SQL request must be preceded by a COLON character.

    USING is a Teradata extension to the ANSI SQL:2011 standard.

    None.

    Embedded SQL does not support the USING request modifier.

    Declare and use input host variables in your embedded SQL applications where you would use the USING request modifier interactively.

    USING imports data rows from a client system as follows:

    1 Each value is retrieved from a client system‑resident data source, such as a disk file, that you must specify using a client utility such as BTEQ.

    For example, if you submit a USING‑modified request through BTEQ, you must precede the request with something like the following BTEQ command:

         .IMPORT DATA FILE=c:\temp\t1

    See Basic Teradata Query Reference for documentation on the .IMPORT command.

    2 The values are passed to Teradata Database as a data parcel along with the text of the request. Iterated requests can pack multiple data parcels with the text of a request.

    3 A value is substituted for each parameter name when the modified SQL request is processed.

    You can import data from a client system by preceding any of the following SQL statements with a USING request modifier:

  • DELETE
  • INSERT
  • MERGE
  • SELECT
  • UPDATE
  • For exporting Teradata Database data to a client, the process is essentially the reverse of that used for data import.

    You can export data to a client system using a client utility such as BTEQ and specifying the BTEQ .EXPORT command, then preceding a SELECT request to retrieve the data to be exported from Teradata Database with an appropriately specified USING request modifier.

    See Basic Teradata Query Reference for documentation on the .EXPORT command.