Functions Are Data Too: (Defunctionalization for PL/SQL)
The authors demonstrate a full-edged implementation of first-class functions for the widely used PL/SQL database programming language. Functions are treated as regular data items that may be constructed at query runtime, stored in and retrieved from tables, assigned to variables and passed to and from other (higher-order) functions. The resulting PL/SQL dialect concisely and elegantly expresses a wide range of new query idioms which would be cumbersome to formulate if functions remained second-class citizens. They include a diverse set of application scenarios that make these advantages tangible.