CREATE TABLE CSDB.DEBT_MARS AS 
SELECT * FROM CSDB.DEBT;
ALTER TABLE CSDB.DEBT_MARS RENAME COLUMN A_MOPDB_LOAD_SET_FK TO A_WORKFLOW_HISTORY_KEY;
BEGIN
  DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CSDB', tabname => 'DEBT', cascade => TRUE, options => 'GATHER AUTO');
END;
/

CREATE TABLE CSDB.DEBT_DAILY_MARS AS 
SELECT * FROM CSDB.DEBT_DAILY;
ALTER TABLE CSDB.DEBT_DAILY_MARS RENAME COLUMN A_MOPDB_LOAD_SET_FK TO A_WORKFLOW_HISTORY_KEY;
BEGIN
  DBMS_STATS.GATHER_TABLE_STATS(ownname => 'CSDB', tabname => 'DEBT_DAILY', cascade => TRUE, options => 'GATHER AUTO');
END;
/

GRANT SELECT ON CSDB.DEBT_MARS TO CSDB_DEBT_RO;
GRANT DELETE, INSERT, SELECT, UPDATE ON CSDB.DEBT_MARS TO CSDB_RW;
GRANT SELECT ON CSDB.DEBT_MARS TO MOA_LAB WITH GRANT OPTION;
GRANT DELETE, INSERT, SELECT, UPDATE ON CSDB.DEBT_MARS TO MRDS_LOADER;

GRANT SELECT ON CSDB.DEBT_DAILY_MARS TO CSDB_DEBT_RO;
GRANT DELETE, INSERT, SELECT, UPDATE ON CSDB.DEBT_DAILY_MARS TO CSDB_RW;
GRANT SELECT ON CSDB.DEBT_DAILY_MARS TO MOA_LAB WITH GRANT OPTION;
GRANT DELETE, INSERT, SELECT, UPDATE ON CSDB.DEBT_DAILY_MARS TO MRDS_LOADER;
