WHENEVER SQLERROR EXIT FAILURE
SET SERVEROUTPUT ON
SET TIMING ON
SET ECHO ON
SET HEADING OFF
SET FEEDBACK ON
SET VERIFY OFF

var filename VARCHAR2(100)
BEGIN
	SELECT 'INSTALL_MARS_723_' || SUBSTR(PDB_NAME, (INSTR(PDB_NAME,'_',1)+1), (LENGTH(PDB_NAME)-INSTR(PDB_NAME,'_',1))) ||  '_' ||TO_CHAR(SYSDATE,'YYYYMMDD_HH24MISS')||'.log' INTO :filename from DBA_PDBS;
END;
/
column filename new_value _filename
select :filename filename from dual;
spool &_filename 

prompt ##### started at time #####
select systimestamp from dual;
prompt ##### database name #####
SELECT  SUBSTR(PDB_NAME, (INSTR(PDB_NAME,'_',1)+1), (LENGTH(PDB_NAME)-INSTR(PDB_NAME,'_',1))) AS PDB_NAME FROM DBA_PDBS;


@@01_MARS_723_install_DW_REF_MAIN_CREATE_AUTOKEY_TRIGGER.sql
@@02_MARS_723_install_REFERENCE_CREATE_AUTOKEY_TRIGGER.sql
@@03_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_DW_REF_MAIN.sql
@@05_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_BALANCE_SHEET_STRUCTURE_H.sql
@@06_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_CAPITAL_KEY_H.sql
@@07_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_COUNTRY_H.sql
@@08_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_CSDB_RATING_ACTION_H.sql
@@09_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_CURRENCY_H.sql
@@10_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_INSTITUTION_ROLE_H.sql
@@11_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_TMS_ACTIVITY_GROUPING_H.sql
@@12_MARS_723_install_OU_REF_CREATE_HISTORY_TRIGGER_TIME_TRANSFORMATION_H.sql

SET ECHO OFF

prompt ##### completed at time #####
select systimestamp from dual;

SPOOL OFF
EXIT