The mi_parameter_nullable() function

The mi_parameter_nullable() function indicates whether the column associated with a specified input parameter in a prepared statement can contain an SQL NULL value.

Syntax

mi_integer mi_parameter_nullable(stmt_desc, param_id)
   MI_STATEMENT *stmt_desc;
   mi_integer param_id;
stmt_desc
A pointer to the statement descriptor for the prepared statement that contains the input parameter.
param_id
The integer parameter identifier of the input parameter, which specifies the position of the input parameter in the prepared statement. Input-parameter numbering follows C programming conventions: the first parameter in the statement is at position zero.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_parameter_nullable() function checks whether the column that is associated with the input parameter at position param_id is nullable. A column is nullable when it was declared with the NOT NULL column-level constraint to specify that it is not able to hold SQL NULL values. For more information about column-level constraints, see the description of CREATE TABLE in the HCL OneDB™ Guide to SQL: Syntax.

The mi_parameter_nullable() function is an accessor function for a statement descriptor, which describes a prepared statement. The statement descriptor stores information about whether input-parameter columns are nullable in the zero-based parameter-nullable array. To obtain information about the nth input parameter, use a param_id value of n-1.

Input-parameter information is available only for the INSERT and UPDATE statements. Support for the UPDATE statement includes the following forms of UPDATE:
  • UPDATE with or without a WHERE clause
  • UPDATE WHERE CURRENT OF

If you attempt to request parameter information for other SQL statements, mi_parameter_nullable() raises an exception.

Return values

0
The column associated with the specified input parameter is defined with the NOT NULL constraint.
1
The column associated with the specified input parameter is defined to accept NULL values; that is, it has not been defined with the NOT NULL constraint.
MI_ERROR
The function was not successful.