Start of change

-158   THE NUMBER OF COLUMNS SPECIFIED FOR name IS NOT THE SAME AS THE NUMBER OF COLUMNS IN THE RESULT TABLE.

Explanation

One of the following situations has occurred:

  • The number of column names that are specified for a view in a CREATE VIEW statement is not the same as the number of elements that are specified in the SELECT clauses of the fullselect that follows. These elements might be column names, SQL functions, and expressions, for example.
  • The number of column names that are specified for a table in a CREATE TABLE statement is not the same as the number of columns in the result table of the fullselect that follows.
  • The number of column names that are specified in a correlation clause is not the same as the number of columns in the corresponding table, view, table expression, table function, or data change table reference.
  • The number of columns that are specified in the RETURNS TABLE clause of a user defined table function is not the same as the number of elements that are specified in the fullselect in the RETURN statement. The fullselect can return zero or more rows with one or more columns. The number of columns in the fullselect must match the number of columns in the function result.
  • The number of column names that are specified in a column list of a common table expression is not the same as the number of elements specified in the fullselect.

System action

The statement cannot be processed.

Programmer response

Specify a column name for each column in the result, and try the request again.

SQLSTATE

42811

End of change