Question: can dml be used in functions?
Answer: You can use DML inside a PL/SQL function - no problem. However, the function can only be called from PL/SQL, not from SQL - i.e. it can be called like this: ... Many people (including me) don't like functions that have "side effects" like this, but that is a matter of best practice and standards, not a technical issue.