Example. Given a document, return the count of the number of authors.
create function author-count(one-doc Document)return integer as
select count(author-list)
from one-doc
The function can be used in a query,
select namefrom doc
where author-count(doc) > 1
Note that, although doc refers to a relation in the from-clause, it is treated as a tuple variable in the where-clause, and can therefore be used as an argument to the author-count function.
However, since the code needs to be loaded and executed with the database system code, it may carry the risk of