Main Content

SQL Prepared Statement Error Messages

This table describes how to address common errors you can encounter when working with SQL prepared statements. For details about SQL prepared statements, see the SQLPreparedStatement object.

Error MessageProbable CausesResolution
Invalid SQL statement. SQL prepared statement must be SELECT, INSERT, UPDATE, DELETE, or CALL.

The SQL prepared statement is invalid.

Specify a valid SQL prepared statement in the SQLPreparedStatement object by using the databasePreparedStatement function. You can specify these SQL statements:

  • SELECT

  • INSERT

  • UPDATE

  • DELETE

  • CALL

Invalid SQL statement. SQL prepared statement must have at least one SQL parameter.

The specified SQL prepared statement is invalid because it has no parameters.

Specify at least one parameter value to bind in the SQL prepared statement by using the databasePreparedStatement function.

Parameter selection out of range. Vector must contain integers between 1 and n, where n is the number of parameters.

The specified indices for the selected parameters in the bindParamValues function are invalid.

Specify indices for the selected parameters within the range of the parameter values in the bindParamValues function. The values must be between 1 and n, where n is the number of parameters.

Parameter index must be a numeric scalar.

The specified indices for the selected parameters in the bindParamValues function are not numeric.

Specify numeric index values for the selected parameters in the bindParamValues function. The values must be between 1 and n, where n is the number of parameters.

Value must be a cell array with length between 1 and n, where n is the number of parameters.

The parameter values in the bindParamValues function are invalid.

The values to bind must be a cell array that has a length between 1 and n, where n is the number of parameters.

See Also

| |

Related Topics