Press "Enter" to skip to content

SQL Loader in Unix Shell Script Example

Here is the SQL Loader shell script example.

#!/bin/ksh

userid="fox"
psw="vinish"
cstring="orcl"

datafilename="/yourdata/abc.csv"
ctlfilename="/yourctl/abc.ctl"
logfilename="/yourlog/sqllog.log"
badlogname="/yourlog/sqlbadlog.log"

sqlldr $userid/[email protected]$cstring data=$datafilename errors=1000 control=$ctlfilename log=$logfilename.log bad=$badlogname

result=$?

if [[ $result -eq 0 ]] then
echo 'Data loaded successfully.'
else
echo 'Data load failed.'
fi

exit $result

See also:

  1. SQL Loader Control File Examples
  2. Import Data Using SQL Loader