ascot diagnostics

A6418

Error: ‘{name}’ is a {actual}, which cannot serve as a {used}; the statement fails when it runs

An embedded SQL statement uses a class query’s stored procedure as a function, or a method’s as a table-valued function in FROM. IRIS compiles the class or routine, and the statement fails when it runs. It gets SQLCODE -357 for a class query used as a function, and SQLCODE -30 for a method in FROM. In a cursor’s SELECT, the class fails to compile instead. Call a method as a function or with CALL, and a class query with CALL or in FROM.

IRIS compiles the example.

Class Demo.SqlPerson Extends %Persistent
{

Property Name As %String;

}
Class Demo.SqlProcedureMisused
{

Query ByName(name As %String) As %SQLQuery [ SqlProc ]
{
    SELECT Name FROM Demo.SqlPerson WHERE Name = :name
}

ClassMethod First() As %String
{
    &sql(SELECT Demo.SqlProcedureMisused_ByName('Ann') INTO :first) //! A6418
    Quit first
}

}

All diagnostics