I am trying to write a shell script which picks up data from a csv file and bulk copies (bcp) it to oracle db. I could write a shell script but not sure how sql bcp works.
Please advice me on how to proceed
Here is a snippet of the script
#!/bin/bash
echo "Now processing step: LOAD_"
DB_CONNECT="USER/PASS@TESTDB"
SPOOLFILE=/home/log.txt
echo "Now processing step:" $DB_CONNECT
sqlplus -s ${DB_CONNECT} <<EOF
spool ${SPOOLFILE}
file="/etc/hosts"
if [ -f "$file" ]
then
echo "$file found."
TRUNCATE TABLE ;
else
echo "$file not found."
fi
Assuming my file is csv file with below data
1,2,3,4
5,6,7,8
10,11,12,13
Thanks