Re: export Data as Text ?

From: Conan <conan_at_>
Date: 2000/08/09
Message-ID: <
%hck5.13976$r4.7242_at_news.indigo.ie>#1/1


Here is a small script i use, with some slight modification it could be called via a batch process

set head off
set pages 0
set verify off
set serveroutput on
set feedback off

SELECT '&&TAB' FROM DUAL; spool dumpfile.sql

select

   decode(c.column_id,1,'Select ',null),    c.column_name,
   decode(c.column_id,p.maxc,'from &&tab ;','||'',''||') from

   user_tab_columns c,
   (select count(*) maxc

      from user_tab_columns
      where table_name=upper('&&tab')) p
where

   table_name=upper('&&tab')
order by

   c.column_id
/

spool off

set head on
SET TERM OFF
set LINES 30000
SET TRIMSPOOL ON
SPOOL &&TAB..TXT declare

   headings1 varchar2(400);
   cursor c1 is

      select column_name
      from user_tab_columns
      where table_name = upper('&&TAB')
      order by column_id;

begin

   for rec in c1
   loop

      headings1 := headings1 || rec.column_name || ',' ;    end loop;
   headings1 := substr(headings1,1,length(headings1)-1);    dbms_output.put_line(headings1);
end;
/

_at_dumpfile.sql

SPOOL OFF
SET TERM ON
undef tab
set verify on

HTH Conan Received on Wed Aug 09 2000 - 00:00:00 CEST

Original text of this message