:embedded-variable[:indicator-variable]
Table 1-12 shows the functions of embedded variables and indicator variables, their uses, and where in a program they can be specified.
Table 1-12 Functions, uses, and specifiable locations of embedded variables and indicator variables
Function | Use | Specifiable locations | |
---|---|---|---|
Embedded variable | Indicator variable | ||
Receipt of a column value as a retrieval result | Receives a value (other than the null value).1 | Used in conjunction with an embedded variable to receive a column value, including the null value. In such a case, the indicator variable indicates whether or not the value read into the embedded variable is the null value. When character data, national character data, mixed character data, or large object data is received, the indicator variable indicates whether or not the data has been received correctly in the embedded variable. | INTO clause of SELECT, FETCH, EXECUTE, or EXECUTE IMMEDIATE statement |
Altering a literal value | Specifies a value (other than the null value).1 | When used in conjunction with an embedded variable to specify the null value, indicates whether or not the value of the embedded variable to be passed to SQL is the null value. | In place of a literal when the value of the literal specified in the SQL statement is modified at the time of execution. |
Specifying a value for a ? parameter | Specifies a value (other than the null value).1 | When used in conjunction with an embedded variable to specify the null value, indicates whether or not the value of the embedded variable to be passed to SQL is the null value. | To specify a value in the ? parameter specified in the SQL that is prepared in the PREPARE statement or that is prepared and executed in the EXECUTE IMMEDIATE statement, specify this item in the USING clause of the EXECUTE, OPEN, or EXECUTE IMMEDIATE statement.2 |
Altering an embedded variable | Specifies another embedded variable in place of an embedded variable in a SELECT statement that is specified in a cursor declaration. | ![]() | USING clause of OPEN statement |
Specifying an SQL character string | Specifies an SQL character string to prepare and execute an SQL statement that was generated when the UAP was executed. | ![]() | PREPARE or EXECUTE IMMEDIATE statement |
Specifying an authorization identifier and password | Indicates to HiRDB the user executing the UAP. | ![]() | Authorization identifier and password in CONNECT statement |
Specifying an RD-node name | Specifies the RD-node at the connection destination. | ![]() | RD-node name in CONNECT statement with RD-node specification, DISCONNECT statement with RD-node specification, or SET CONNECTION statement |
: Not applicable.
1 To handle the null value, an indicator variable must also be specified; see 1.5.5 Setting a value for an indicator variable below for the values of indicator variables.
2 An indicator variable cannot be specified in the USING clause of the OPEN statement.
When you are coding embedded variables and indicator variables in a UAP, data can be exchanged between an SQL and the UAP without causing a data conversion if certain relationships hold between the data types and data descriptions involved. For those relationships, see the HiRDB Version 8 UAP Development Guide.
COBOL allows the qualifying of embedded variables and indicator variables with a group item.
:[variable-name-1.] variable-name-2
Any qualified embedded variable or indicator variable should be specified so that the result of qualification is unique. Names that need not be qualified can be qualified. If there are several possible combinations of qualifiers that result in a unique qualification, any of such combinations can be used.
variable-name-1 is the group item to which variable-name-2 is subordinate.
C allows the qualifying of a member of a structure with a structure or a pointer to a structure.
: structure-name.member-name
: pointer-name-> member-name
In the case of remote database access, if a distributed client that does not support 0 as the actual length of a variable-length character string (including national and mixed) variable uses a variable-length character string variable to search a character string whose actual length is 0, spaces of actual length 1 will be set as the search result.
Table 1-13 shows the substitution relationships between UAP embedded variables and SQL data types.
Table 1-13 Substitution relationships between UAP embedded variables and SQL data types
Embedded variable's data type | SQL's data type | ||
---|---|---|---|
Character data | National character data | Mixed character data | |
Character data | Y | ![]() | Y |
National character data | ![]() | Y | ![]() |
Mixed character data | Y | ![]() | Y |
Y: Can be substituted.
: May be substituted; care must be exercised because substitution may occur regardless of the data type (see Note 2 and Note 3).