16.20 - Calling a Stored Procedure Using FNC_CallSP - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
English (United States)

This example extends the preceding example, Simple External Stored Procedure, by calling the FNC_CallSP library function to call the addRegion stored procedure. The external stored procedure strips off the first four characters of the region input argument and passes the result to the addRegion stored procedure, which inserts the string into the regionTable table.

The addRegion stored procedure is defined like this:

CREATE PROCEDURE addRegion (IN region VARCHAR(64),
                            OUT region_count INTEGER)
   INSERT INTO regionTable VALUES (:region);
   SEL COUNT(*) INTO :region_count FROM regionTable;

The regionTable table is defined like this:

CREATE TABLE regionTable (region VARCHAR(64));