An SQL query statement.
A generalised boolean.
The Common Lisp
macro has been extended with a clause for iterating over query results. This extension is available only when Common SQL has been loaded. For a full description of the rest of the Common Lisp
facility, including the possible return values, see the ANSI Common Lisp specification.
Each iteration of the loop assigns the next record of the table to the variable
. The record is represented in Lisp as a list. Destructuring can be used in
to bind variables to specific attributes of the records resulting from
. In conjunction with the panoply of existing clauses available from the
macro, the new iteration clause provides an integrated report generation facility.
The additional loop keywords
may be useful when fetching many records through a connection with
. See the section Special considerations for iteration functions and macros for details.
example performs the following on each record returned as a result of a query: bind
to the query result, find the salary (if any) from an associated hash-table, increment a count for salaries greater than 20000, accumulate the salary, and print the details. Finally, it prints the average salary.