Retrieving the Identity Column Value - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide - 17.20

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Lake
Product
Teradata Preprocessor2
Release Number
17.20
Publication Date
April 2023
Content Type
Programming Reference
Publication ID
B035-2446-043K
ft:locale
en-US
ft:lastEdition
2023-04-21
dita:mapPath
neh1679404006646.ditamap
dita:ditavalPath
obe1474387269547.ditaval
ft:sourceId
dita
dita:id
B035-2446
Product Category
Teradata Tools and Utilities

To retrieve the identity column value, use the INSERT statement and declare one host variable to retrieve that value. Below are three syntax examples:

EXEC SQL INSERT [INTO] <table name> VALUES (...expressions) RETURNING :HOSTVARIABLE,...
EXEC SQL INSERT [INTO] <table name> (column name) VALUES (...expressions) RETURNING
:HOSTVARIABLE,...
EXEC SQL INSERT [INTO] <table name> DEFAULT VALUES RETURNING :HOSTVARIABLE,...