External SQL Procedures & SQL | CREATE PROCEDURE | VantageCloud Lake - External SQL Procedures and SQL: CREATE PROCEDURE and REPLACE PROCEDURE (External Form) - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

You can run SQL function calls from external procedures using either of the following languages and APIs.

External Routine Language API to Run SQL
C or C++ CLIv2
Java JDBC

You cannot embed SQL statements in an external procedure, you can only use standard CLIv2 or JDBC function calls to the appropriate driver, which translates them into SQL requests and submits them to the Parser for processing.

The database does not support SQL function calls for mainframe-attached systems.

See Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems, B035-2418 or Teradata JDBC Driver Reference, available at https://teradata-docs.s3.amazonaws.com/doc/connectivity/jdbc/reference/current/frameset.html, for information about the available SQL function calls.

Restrictions on Declaring an C++ External Procedure

If you specify CPP in the Language Clause, then you must declare the called C++ procedure as extern "C" to make sure that the procedure name is not converted to an overloaded C++ name, for example.

extern "C"
void my_cpp(long int *input_int, long int *result, char sqlstate[6])
{