Convert TRUNC of a date to DATE_TRUNC
ProprietaryReplaces Oracle's TRUNC of a date with DATE_TRUNC, as PostgreSQL's TRUNC only truncates numbers. Column types are unknown, so a TRUNC is converted only when its format, such as 'MM', or its argument, such as SYSDATE or a TO_DATE call, shows that it truncates a date. Formats that DATE_TRUNC has no unit for, such as 'WW' or 'D', are left as they are.
org. openrewrite. sql. ConvertTruncToDateTruncmod run . --recipe= org. openrewrite. sql. ConvertTruncToDateTruncInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.