WHENEVER SQLERROR EXIT SQL.SQLCODE
WHENEVER OSERROR EXIT

SET LONG 2000000
SET PAGESIZE 0
SET LINES 32767
SET TRIMSPOOL ON
SET VERIFY OFF
SET ECHO OFF

column txt format a350 word_wrapped
exec dbms_metadata.set_transform_param(dbms_metadata.session_transform, 'EMIT_SCHEMA', false);

spool "&2"
SELECT DBMS_METADATA.GET_DDL('TYPE','&1') FROM DUAL;
spool off

quit;
/