Error: ‘{name}’ is a {actual}, which cannot serve as a {used}; the statement fails when it runs
A class query’s stored procedure used as a function in an expression, or a method’s used as
a table-valued function in FROM: SQL calls a method as a function, and a class query with
CALL or in FROM. IRIS compiles the statement and gives it SQLCODE -357 (a class query
as a function) or -30 (a method in FROM) when it runs.
IRIS rejects the example.
Class Demo.SqlPerson Extends %Persistent
{
Property Name As %String;
}
IRIS compiles the example.
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
}
}