Home » Linux/Unix » SQL Loader in Unix Shell Script Example

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/$psw@$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

2 thoughts on “SQL Loader in Unix Shell Script Example”

  1. hi
     Write a script to populate the new Timer table from a data file
    (Design decision: spreadsheet or other data file form).

    can u help in this??

Comments are closed.