Overview
This document describes the causes and recommended actions for handling ERR-1105D and ERR-31386 errors that may occur during query execution.
Version
In Altibase version 6.1.1 and earlier, only the ERR-1105D error code and message are generated.
Starting from versions 6.3.1, 6.5.1, and 7.1.0 or later, the error code was updated to ERR-31386, and the message format was modified accordingly.
Symptom
The following error occurs when a function is used inside a SELECT statement.
6.1.1 or earlier
6.3.1, 6.5.1
7.1.0 or later
Cause
The description of the error can be checked using the altierr utility as follows.
6.1.1 or earlier
$ altierr 0x1105D
0x1105D ( 69725) smERR_ABORT_smiCantBeginUpdateStatement Unable to begin a new update statement.
# *Cause: Either the statement is read-only, or more than one update child statement has been requested.
# *Action: Please make sure that the request to begin a new update statement is valid.
6.3.1 or later
$ altierr 0x31386
0x31386 ( 201606) qpERR_ABORT_QSX_PSM_INSIDE_QUERY Cannot perform a DML, commit, or rollback inside a query.
# *Cause :
# - The program attempted to perform a DML, commit, or rollback inside a query.
# *Action :
# - Do not use a DML, commit, or rollback statement inside a query.
When using a function within a SELECT statement, the function must contain only the SELECT statement.
If the function includes INSERT/UPDATE, the above error occurs.
Solution
Functions used within the SELECT statement must contain only the select statement.
# Example of where an error occurs when a function including an insert statement is used in a SELECT statement
# Example of executing the above function using execute statement
Executed successfully in the execute statement.
# Example that is successfully executed when the above function is used in the SELECT statement after removing the insert statement to use it in the SELECT statement.