Retrieving the Identity Column Value - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

Product
Preprocessor2 for Embedded SQL
Release Number
15.00
Language
English (United States)
Last Update
2018-09-27
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities

Retrieving the Identity Column Value

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,...