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

Vinish Kapoor

I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me, it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub and get notifications for new posts.

You may also like:

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *