"Given that creating database objects of any kind except tables and indexes had to be avoided (do not ask), I could not just write (or steal from Tom Kyte) a PL/SQL function for that." . . . . .