fix problems with replacing materialised views, and update PL/SQL procedures for Oracle 12
keep the Oracle 12 PL/SQL compiler happy
fix comment style
back out removal of obsolete parameters. They're still referred to elsewhere in procedures etc, so need proper cleaning
move creating views to after creating helper functions, since gmtime is needed by one of the views