15.10 - Retrieving the Identity Column Value - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

prodname
Preprocessor2 for Embedded SQL
vrm_release
15.10
category
Programming Reference
featnum
B035-2446-035K

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