-540   THE DEFINITION OF TABLE table-name IS INCOMPLETE BECAUSE IT LACKS A PRIMARY INDEX OR A REQUIRED UNIQUE INDEX

Explanation

An attempt was made to use table table-name in a CREATE or ALTER statement to define a foreign key or a clone table, or it was referenced in an SQL manipulative statement. However, the current status of the table is incomplete, so it cannot be used as specified. The definition of the table may be incomplete because the table was defined with a PRIMARY KEY clause, a UNIQUE clause, or a ROWID column with the GENERATED BY DEFAULT attribute. The definition of the table is incomplete, and it cannot be used until a required index is defined for:
  • the primary key (the primary index)
  • a ROWID column
  • for each set of columns in any UNIQUE clause (the required unique indexes).
An attempt was made to use the table in a FOREIGN KEY clause or in an SQL manipulative statement.

System action

The statement cannot be processed.

Programmer response

Define a primary index or a required unique index on the table before referencing it.

SQLSTATE

57001