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

Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.in and orclqa.com a question and answer forum for developers.

This Post Has 2 Comments

  1. Shilpa

    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??

    1. Vinish Kapoor

      Please ask your question with more details on https://orclqa.com

Comments are closed.