spool

set head off;
set feed off;
set define off;
set autoprint off;
set termout off;
set heading off;
set flush off;
set feedback off;
set pagesize 0;
set linesize 18000;
set echo off;
set trim on;
set trimspool on;
spool /tmp/testdc.TXT;
select ''|| REPLACE(REPLACE(REPLACE(TRIM(PROVINCE_CUST_ID),chr(9),''),chr(13),''),chr(10),'') || ','
      || REPLACE(REPLACE(REPLACE(TRIM(GROUP_ID),chr(9),''),chr(13),''),chr(10),'') || ','
      || REPLACE(REPLACE(REPLACE(TRIM(CUST_NAME),chr(9),''),chr(13),''),chr(10),'') ||  ','
      || REPLACE(REPLACE(REPLACE(TRIM(CBSS_CUST_ID),chr(9),''),chr(13),''),chr(10),'') || ','
      || REPLACE(REPLACE(REPLACE(TRIM(EPARCHY_CODE),chr(9),''),chr(13),''),chr(10),'') || ','
      || (select  REPLACE(REPLACE(REPLACE(TRIM(c.AREA_NAME),chr(9),''),chr(13),''),chr(10),'')
        from td_m_political_location c where c.area_code = t.eparchy_code),chr(13) || chr(10) || ''
  from tf_f_cust_group_p51 t
  where cust_id = 16070501 ;
spool off
exit;
EOF

猜你喜欢

转载自andyniu.iteye.com/blog/2326466