Error: Field ‘{field}’ not found in the applicable tables ({tables}); the statement gets SQLCODE -29 when it runs
An embedded SQL statement names a column that none of its tables has. A table’s columns are
the properties of its class, inherited ones included, each under its own name, or its
SqlFieldName instead. A serial property’s fields are columns named Property_Field. The
row ID column is ID, or the class’s SqlRowIdName instead. IRIS compiles the class or
routine, and the statement gets SQLCODE -29 when it runs. Spell the column as the class
projects it.
IRIS compiles the example.
Class Demo.SqlPerson Extends %Persistent
{
Property Name As %String;
Property Age As %Integer [ SqlFieldName = Years ];
}
Class Demo.SqlFieldNotFound
{
ClassMethod Oldest() As %String
{
&sql(SELECT Name INTO :name FROM Demo.SqlPerson WHERE Age > 90) //! A7340
Quit name
}
}