Version
Version 6.1.1 or earlier.
Error codes and messages have been changed in version 6.3.1.
Symptom
The following error occurs when using the function in the SELECT statement.
In version 6.3.1, error codes and messages have been changed as follows.
Cause
The description of the error can be checked using the altierr utility as follows.
# Version 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.
$ 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.