Database 11g

Tuesday, April 3, 2018

Load Excel Data in Oracle Tables Using SQL-Loader


Hi Guys,

Today I will show you how simple is to load data in oracle table from Excel using 'SQL-LOADER' utility.

Steps:-

> First convert the Excel file into (.CSV) format.
> Table Structure like column names and Data types values in Excel sheet Should be same in the Database.
> Create Controlfile in notepad and mention parameters like..

LOAD DATA
INFILE 'C:\Users\Desktop\EMP1.csv'
INTO TABLE EMP1
FIELDS TERMINATED BY ','OPTIONALLY ENCLOSED BY ","
(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)


> Now run the sqlldr utility with username/password and controlfile (.ctl) path.
> Check the row count after you get 'COMMIT POINT REACHED' message.
> We have loaded 10 records from excel Sheet which displays the output 'logical record 10'



D:\app\oracle> sqlldr sam/s control=C:\Users\Desktop\load.ctl log=emp1.log
SQL*Loader: Release 11.2.0.3.0 - Production on Sun Dec 4 10:33:40 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Commit point reached - logical record count 10


> Now check the table counts.

SQL> select count(*) from emp1;

  COUNT(*)
-----------
        10


Happy Learning...


No comments:

Post a Comment