Stored Procedure Return Result - Call-Level Interface Version 2

Teradata Call-Level Interface Version 2 Reference for Workstation-Attached Systems

Product
Call-Level Interface Version 2
Release Number
15.00
Language
English (United States)
Last Update
2018-09-25
dita:id
B035-2418
lifecycle
previous
Product Category
Teradata Tools and Utilities

Stored Procedure Return Result

Usage Notes

The application sends the statements composing a procedure to the Database, where they are compiled and saved for subsequent execution. The application that defines the procedure must send an SQL statement to create (CREATE PROCEDURE) or replace (REPLACE PROCEDURE) the procedure.

If the Database does not support External Stored Procedures the SQL will be rejected (there is no capability provided to ensure that the SQL is supported).

If it is supported, an ElicitFile response parcel will be returned, whereupon the application uses the CLIv2 ContinueRequest function to send the procedure's statements to the Database.

When all statements have been sent, the procedure is compiled and saved on the Database. The character set used for compilation is the character set used when the procedure is created or replaced.

Using the Procedure

To invoke a previously compiled and saved procedure, an SQL CALL statement is sent to the Database. When called, the procedure that was defined with the SQL READS SQL DATA or WRITES SQL DATA clause may itself invoke CLIv2 to establish a connection and send SQL requests. Such a connection may either be a new connection (a DBCAREA Use-default-conn value of 'N'), for which a standard Database logon string would be supplied, or the connection could use the same session used to CALL the procedure (a DBCAREA Use-default-conn value of 'Y').

The latter is known as the default connection, and has some limitations. Specifically, the character set used when the procedure is executed is the character set established when the procedure is created or replaced, not the character set being used when the CALL is sent. No capability is provided for the procedure to ascertain this character set.

Also, the following options established by the application cannot be changed:

  • Date-form
  • Language-conformance
  • Statement-status
  • Transaction-semantics
  • 2PC
  • No capability is provided for the procedure to ascertain the application's setting for these options. Also, the default connection may not be disconnected.

    The procedure may use the DBCAREA Return-result-to option to provide CLIv2 the same information that would be provided by the WITH RETURN clause on the SQL PROCEDURE statement for an SQL Stored Procedure. Specifically, whether the results for an SQL request are returned to the requester, the caller of the procedure, or the application. If propagated to the caller or application, the parcels are preceded by a ResultSet response parcel.

     

    Language

    Variable Name

    COBOL:

    SP-RETURN-RESULT

    C:

    SP_return_result

     

    Routine

    Action Taken

    DBCHINI:

    writes

    DBCHCL:

    read(RSUP;IRQ)

     

    Used by

    Action Taken

    application program

    writes

    Possible value can be set in this DBCAREA field is 0 through 5.