Re: Any tool to unload oracle7.3 table data to ascii format?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 23 Jan 1999 02:27:33 GMT
Message-ID: <36aa330a.2577055_at_192.86.155.100>


A copy of this was sent to Albert Zhu <lzhu_at_mail.gte.net> (if that email address didn't require changing) On Fri, 22 Jan 1999 21:09:21 -0500, you wrote:

>I am looking for a oracle tools to unload oracle 7.3.4 to nice ascii
>format.
>All I found it sql*loader but did not find any sql*unloader. Our
>platform
>is Solaris.
>
>Any help is very appreciated.
>
>Albert
 

this will do it with sqlplus:



#!/bin/sh

if [ "$1" = "" ]
then

	cat << EOF
usage:		flat un/pw [tables|views]

example:	flat scott/tiger emp dept

description:	Select over standard out all rows of table or view with 
		columns delimited by commas.
EOF
	exit

fi

PW=$1
shift

for X in $*
do
sqlplus -s $PW << EOF > /tmp/flat$$.sql

set	wrap off
set	feedback off
set	pagesize 0
set	verify off
prompt	select
select	lower(column_name)||'||'',''||'
from	user_tab_columns
where	table_name = upper('$X') and
	column_id != (select max(column_id) from user_tab_columns where
			 table_name = upper('$X'))
/
select	lower(column_name)
from	user_tab_columns
where	table_name = upper('$X') and
	column_id = (select max(column_id) from user_tab_columns where
			 table_name = upper('$X'))
/
prompt	from	$X
prompt	/
prompt	exit

exit
EOF
sqlplus -s $PW << EOF
set	wrap off
set	feedback off
set	pagesize 0
set	verify off

set trimspool on
set linesize 5000
start /tmp/flat$$.sql
exit
EOF
rm /tmp/flat$$.sql
done
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/    -- downloadable utilities
 
----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation
 
Anti-Anti Spam Msg: if you want an answer emailed to you, 
you have to make it easy to get email to you.  Any bounced
email will be treated the same way i treat SPAM-- I delete it.
Received on Sat Jan 23 1999 - 03:27:33 CET

Original text of this message