Calling a Stored Procedure Using FNC_CallSP | Teradata Vantage - Calling a Stored Procedure Using FNC_CallSP - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
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));