Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Extract ASCII file from table
A copy of this was sent to Interlog User <orita_at_interlog.com>
(if that email address didn't require changing)
On Thu, 10 Jun 1999 21:30:15 -0400, you wrote:
>Hi,
>
>Is there a method or utility in Oracle 7.3 or 8.0.5 to extract
>table data in ASCII format to a file like the "bcp" utility in Sybase
>???
>
>I tried with sqlplus, but it comes with all kinds of header and other
>information.
>
>Answers appreciated.
>
>
>
In unix, try this (if in nt, let me know, i have .cmd files for NT)
#!/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. EOF exit
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
set wrap off set feedback off set pagesize 0 set verify off
See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'... Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/
Current article is "Fine Grained Access Control", added June 8'th
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA--