Scope of Statement Identifiers

A program can consist of one or more source-code files. By default, the scope of reference of a statement identifier is global to the program. A statement identifier created in one file can be referenced from another file.

In a multiple-file program, if you want to limit the scope of reference of a statement identifier to the file in which it is executed, you can preprocess all the files with the -local command-line option.

INTO Clause

Use the INTO clause to save the returned values of these SQL statements:
  • A prepared singleton SELECT statement that returns only one row of column values for the columns in the select list
  • A prepared EXECUTE FUNCTION (or EXECUTE PROCEDURE) statement for an SPL function that returns only one set of values
The INTO clause of the EXECUTE statement has the following syntax:
(1)
INTO Clause

1  INTO
2.1 + , output_var? 
2.2.1 1 :
2.2.1 INDICATOR
2.1 indicator_var
2.1  SQL DESCRIPTOR
2.2.1 descriptor_var
2.2.1 'descriptor'
2.1  DESCRIPTOR sqlda_pointer
Notes:
  • 1 HCL OneDB™ extension
Element Description Restrictions Syntax
descriptor Quoted string that identifies a system-descriptor area Must already be allocated. Use single ( ' ) quotation marks Quoted String
descriptor_var Host variable that identifies a system-descriptor area System-descriptor area must already be allocated Language specific
indicator_var Host variable that receives a return code if corresponding parameter_var is NULL value, or if truncation occurs Cannot be DATETIME or INTERVAL data type Language specific
output_var Host variable whose contents replace a question-mark ( ? ) placeholder in a prepared statement Must be a character data type Language specific
sqlda_pointer Pointer to an sqlda structure that defines data type and memory location of values to replace a question-mark ( ? ) placeholder in a prepared object Cannot begin with a dollar sign ( $ ) or a colon ( : ) symbol. An sqlda structure is required with dynamic SQL DESCRIBE INPUT statement

This closely resembles the syntax of the USING Clause.

The INTO clause provides a concise and efficient alternative to more complicated and lengthy syntax. In addition, by placing values into variables that can be displayed, the INTO clause simplifies and enhances your ability to retrieve and display data values. For example, if you use the INTO clause, you do not need to use a cursor to retrieve values from a table.

You can store the returned values in output variables, in output SQL descriptors, or in output sqlda pointers.