HabBoy
asked on
retrieving data from oracle to flat file
Hi,
I am new to unix and would like to write a script that would allow me to extract 2 fields from an oracle database and write them out to a flat file.
Could someone point me in the right direction.
Thanks
I am new to unix and would like to write a script that would allow me to extract 2 fields from an oracle database and write them out to a flat file.
Could someone point me in the right direction.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks bira.
Habboy
Habboy
#!/bin/sh
sqlplus scott/tiger 2>/dev/null <<EOC
set heading off feed off term off
spool flat.txt
select ename || '|' || job || '|'
from emp;
spool off
quit
EOC
# flat.txt lists ename and job, delimited by "|".
# Each line is terminated by "|". You may
# use Unix utilities such as sed, awk to process it
Regards.