SET TERMOUT OFF
SET NEWPAGE 0
SET SPACE 0
set trimspool on
set linesize 288
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
set heading off
SPOOL  E:\reports\hosp10\Ecr_Vendor_Code.csv
select
'RPT_REC_NUM'
||','||'RPT_STUS_CD'
||','||'PRVDR_NUM'
||','||'FY_BGN_DT'
||','||'FY_END_DT'
||','||'ECR_VENDOR_CD'
from dual;

  SELECT      RPT_REC_NUM
           || ','
           || RPT_STUS_CD
           || ','
           || PRVDR_NUM
           || ','
           || FY_BGN_DT
           || ','
           || FY_END_DT
           || ','
           || ECR_VENDOR_CD
    FROM   VALHOSP10.HOSP10_RPT_TBL O236015
ORDER BY   PRVDR_NUM ASC, (FY_BGN_DT) ASC;

spool off
