Refactoring this is technically possible but not sure if required, the other function uses the JDBC $fn syntax which you can't use in DDL creation. In the DDL if the database accepts an int it is slightly different as well.