Convert a ROWNUM bound to LIMIT

Proprietary

Replaces an upper bound on Oracle's ROWNUM in a query's WHERE clause, as in WHERE ROWNUM <= 10, with a LIMIT. Oracle numbers the rows before it sorts, groups, aggregates, or removes duplicates, so a query that does any of those is left as it is, while the common SELECT * FROM (... ORDER BY ...) WHERE ROWNUM <= n converts. A ? parameter as the bound moves to the end only when no other ? parameter follows it.

org.openrewrite.sql.ConvertRownumToLimit
mod run . --recipe=org.openrewrite.sql.ConvertRownumToLimit

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.