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_830_' || 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_830_install_CSDB_T_MARS_TABLES.sql


SET ECHO OFF

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

SPOOL OFF
EXIT