0% found this document useful (0 votes)
21 views3 pages

Oracle SQL*Loader Data Loading Guide

The document describes the process of loading data from a flat file into Oracle Applications base tables using SQL*Loader. SQL*Loader is used to load data from a file into a database table. It requires a control file (.ctl file) that specifies the data file, table, and column details. The .ctl file is registered as a concurrent program to load the data. Options like insert, append, truncate control how the data is loaded into the table. Additional options allow loading a subset of rows, skipping rows, and handling comma within data fields.

Uploaded by

Sadasiva M
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Oracle SQL*Loader Data Loading Guide

The document describes the process of loading data from a flat file into Oracle Applications base tables using SQL*Loader. SQL*Loader is used to load data from a file into a database table. It requires a control file (.ctl file) that specifies the data file, table, and column details. The .ctl file is registered as a concurrent program to load the data. Options like insert, append, truncate control how the data is loaded into the table. Additional options allow loading a subset of rows, skipping rows, and handling comma within data fields.

Uploaded by

Sadasiva M
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

IN Bound Interfaces

------------------------------------

The process of loading the data from flat file to Oracle Apps Base tables.

Process
-------------------
SQL*Loader Import Program
xls -----------> csv ----------------------> Interface table
----------------------> Base table

SQL*Loader
--------------------------------
It is tool used to load the data from file to a table.
It requires control file to load the data.
Its is developers responsibility to create .ctl file.

Syntax of control file:


----------------------------------

LOAD DATA
infile '<data file path >'
insert / append/ truncate into table <table_name > fields terminated by ','
( col1, col2, coln )

Ex:
------------

LOAD DATA
infile 'C:\data\student_data.txt'
insert into table student fields terminated by ','
( sno, sname, marks )

----------------------------------------

Register the ctl file as concurrent program.

Step 1 : Transfer the data file to the server.


/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out

Step 2: Transfer the ctl file to the bin directory.

ctl file
-----------------------
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
insert into table student fields terminated by ','
( sno, sname, marks )

Step 3: Register the ctl file as concurrent program.


Executable Name -- MZ_STUDENT_LOAD_EXEC
Short Name -- MZ_STUDENT_LOAD_EXEC
Application -- Inventory
Method - SQL*Loader
Executable file name - mz_load ( ctl file )

Save.

++++++++++++++++++++++++++++++++++++

Program -- MZ_STUDENT_LOAD_PROG

Request Group - All Inclusive GUI


++++++++=++++++++++++++++++++++

insert -- Table should be empty.


append -- Add to existing data. -- 10,000 + 20 = 10020

Truncate -- Truncate the table and data is loaded.

++++++++++++++++++++++++++++++++++++++++

Load first 'n' rows


--------------------------

options ( load = 5 )
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ','
( sno, sname, marks )

+++++++++++++++++++++++++++++++++++++++

Skip the rows


-----------------------

options ( skip = 5 )
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ','
( sno, sname, marks )

+++++++++++++++++++++++++++++++++++++++++

Bad file
-------------
Contains rejected rows.
Bad file information is available in log file.
Bad file name is same as request ID

++++++++++++++++++++++++++++++++++++++++++++++

How to load comma as part data


-------------------------------------------------
Step 1: Enclose the data in " "

104,"arun,rao",40
105,"arun,rao",40

Step 2: Use optionally enclosed by clause in ctl file.

Ex:
-------
LOAD DATA
infile '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out/student_data.txt'
truncate into table student fields terminated by ',' optionally enclosed by
'"'
( sno, sname, marks )

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Common questions

Powered by AI

Submitting SQL*Loader as a concurrent program in Oracle Apps facilitates automation by enabling scheduled or user-triggered data loads through a graphical user interface, which enhances operational efficiency and reduces manual intervention. This integration allows for robust error management, as failed operations or records are logged and reported through bad files, providing transparency and traceability in data handling. The automated approach minimizes human errors and allows scalable deployment of data loads across complex databases .

The process of setting up a control file for data loading using SQL*Loader begins with transferring the data file to the server, for example, to the directory '/d01/oracle/VIS/apps/apps_st/appl/inv/12.0.0/out'. The control file, which contains the directives for loading the data, must be placed in the bin directory. Next, the control file needs to be registered as a concurrent program in the system. This involves defining the program executable with parameters such as Executable Name (e.g., MZ_STUDENT_LOAD_EXEC), Method (SQL*Loader), Executable file name, and Application. The concurrent program allows the data load to be initiated through the Oracle Apps interface .

To skip a specified number of rows in SQL*Loader, you can use the 'options ( skip = n )' clause in the control file, where 'n' represents the number of initial rows to be skipped in the data file. This configuration is useful when partial data loads are needed or when the initial lines of a data file contain metadata or non-relevant entries. An example configuration would be 'options ( skip = 5 )', which ensures that the first five rows in the data file are not loaded into the table .

In SQL*Loader, the 'insert' command loads data only if the target table is empty; it is ideal for initial data population when setting up a new table. 'Append' allows additional data to be added to existing table data, which is useful in applications that receive frequent incremental updates. 'Truncate' clears the table of any existing data before loading new data, useful for completely refreshing a table with new information. Choosing between these depends on the desired outcome: preserving or discarding existing data .

To load a specific number of rows from a data file using SQL*Loader, you can use the 'options ( load = n )' clause in the control file, where 'n' is the number of rows to be loaded. This option is placed at the head of the control file together with LOAD DATA directive. For instance, 'options ( load = 5 )' indicates that only the first five rows in the data file should be loaded into the database table .

The bad file generated during the SQL*Loader process contains rows that were rejected during the loading process due to errors or inconsistencies. The bad file helps in diagnosing data issues by providing logs of failed entries. The name of the bad file typically corresponds to the request ID of the SQL*Loader operation, making it easier to relate it to specific execution attempts .

To integrate SQL*Loader operations into an Oracle Apps environment, the control file must be registered as a concurrent program. This involves setting up the executable in the Oracle Apps with the following parameters: Executable Name (a unique identifier for the loader program), Short Name, Application (the respective app module, e.g., Inventory), Method (set as SQL*Loader to indicate the operation type), and the executable file name (the control file name without the extension). Once configured, this setup allows end-users to initiate SQL*Loader processes through the Oracle interface, automating data loading tasks .

To properly load data values that contain commas, you must enclose the data values in double quotes. Furthermore, the control file should include the 'optionally enclosed by' clause to specify that fields may be enclosed by quotes. For example, a data line like '104,"arun,rao",40' indicates that 'arun,rao' is a single field value. The control file directive would be 'fields terminated by ',' optionally enclosed by '"'' .

SQL*Loader handles several data loading operations which are specified in the control file: 'insert', 'append', and 'truncate'. The 'insert' operation requires the target table to be empty before loading data. The 'append' operation allows data to be added to existing data in the table, making it suitable for large datasets over multiple load operations. For example, if the table initially has 10,000 entries and 20 new entries are loaded, the total will become 10,020. The 'truncate' operation removes existing data from the table, allowing data to be loaded afresh .

The 'optionally enclosed by' clause in an SQL*Loader control file is particularly useful when dealing with datasets where values contain delimiters like commas. For instance, in a dataset where names are in the format 'Last, First', enclosing each name in quotation marks helps SQL*Loader recognize the full name as a single entity rather than two separate fields. Using 'optionally enclosed by' ensures these fields are correctly parsed and loaded into database columns as intended, preserving the integrity of the data .

You might also like