Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: select/insert into/from a file ?
hi lisa,
if you are on unix, you will love these...
have a good day.
btw, i hope i am not too late...
unload.bat
---
if [ $# -lt 3 ]
then
echo "Usage : unload <username> <password> <table> <query>"
echo "Example : unload system manager sube \"where sube=1\""
exit 99
fi
sqlplus -s $1/$2 << EOF > unload.tmp
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('$3') and column_id != (select max(column_id) from user_tab_columns where table_name = upper('$3')) / select lower(column_name)||'||''|''' from user_tab_columns where table_name = upper('$3') and column_id = (select max(column_id) from user_tab_columns where table_name = upper('$3'))
sqlplus -s $1/$2 << EOF
set wrap off
set feedback off
set pagesize 0
set verify off
set trimspool on
set linesize 5000
start unload.tmp
exit
EOF
rm unload.tmp
---
special thanks to thomas kyte for unload...
load.bat
---
if [ $# -lt 6 ]
then
echo "Usage : sqlloader <username> <password> <table> <filename>
<tnsentry> <delimeter>"
echo "Example : sqlloader system manager sube sube.txt develop |"
exit 99
fi
echo "unrecoverable load data" > sqlloader_$3.par echo "infile \"$4\"" >> sqlloader_$3.par echo "append into table $3" >> sqlloader_$3.par echo "fields terminated by \"$6\"" >> sqlloader_$3.par echo "(" >> sqlloader_$3.par
-- ===================================== Hakan Yuksel, Oracle DBA TekstilBank - Istanbul, TURKEY email:hyuksel_at_tekstilbank.com.tr http://members.xoom.com/hakan_yuksel/ ===================================== In article <8oobg5$3gp$1_at_mailint03.im.hou.compaq.com>, "Lisa Spielman" <lisa.spielman_at_compaq.com> wrote: > I need to move data from 1 database to another and need > to do this using files. There are about 8 tables and the > largest table has about 100 rows. > > Is there a simple way to do this in Oracle ? > > Informix makes this really easy: > unload to x.dat select * from tableX > load from x.dat .... > > Can I select * from table x into a file, and then insert > from this file into the same table in another database ? > > thanks, Lisa > > Sent via Deja.com http://www.deja.com/ Before you buy.Received on Wed Sep 13 2000 - 03:17:58 CDT