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

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢

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)
BEGIN
   INSERT INTO regionTable VALUES (:region);
   SEL COUNT(*) INTO :region_count FROM regionTable;
END;

The regionTable table is defined like this:

CREATE TABLE regionTable (region VARCHAR(64));