Spurious "loop" phrase left over from PostgreSQL.  And instead of selecting
the stored proc into a variable, it needs to be called as a procedure.