NAME

ETLp::Loader::OracleSQLLoader - Load data using SQL*Loader

SYNOPSIS

This module will load data using Oracle's SQL*Loader utility. It is designed to be used when:

* The backend database is Oracle
* The functionality is not provided by ETLp::Loader::CSV
* Speed is of the essence, and features such as direct path or
  parallel loading are required.

For Example

use ETLp::Loader::OracleSQLLoader;

my $sqlldr = ETLp::Loader::OracleSQLLoader->new(
    userid           => 'scott/tiger',
    table            => 'scores',
    filename         => "$data_directory/$filename",
    specification    => $specification,
    mode             => 'truncate',
    controlfile      => "$outfile_directory/$filename.ctl",
    logfile          => "$outfile_directory/$filename.log",
    discardfile      => "$outfile_directory/$filename.dsc",
    badfile          => "$outfile_directory/$filename.bad",
);

my $recode = $sqlldr->load;

if ($retcode) {
    print $sqlldr->error;
}

METHODS

new

Creates a new ETLp::Loader::OracleSQLLoader object. Accespts the following attributes:

* userid. Required. The username and password of the user connecting
  to the database, in the form:
      o <user>/<password> or
      o <user>/<password>@<tns alias>
* controlfile. Required. The name of the control file. The content
  will be generated by this module.
* table. Required. The name of the table that the data will be loaded
  into
* filename. Required. The file to be loaded.
* mode. Optional. The type of load - append, truncate, insert or
  replace. Defaults to append
* specification. Required. The specification of the incoming file and
  the processing. E.g.
  
        fields terminated by "," 
        (id, name, score, file_id constant 4)
        
* logfile. Optional. The name of the log file
* badfile. Optional. The name of the bad file.
* discardfile . Optional. The name of the discardfile.
* keep_controlfile. Optional. Whether to keep the control file
  following processing. Defaults to no (0).
* keep_logfile. Optional. Whether to keep the log file
  following processing. Defaults to yes (1).
* keep_badfile. Optional. Whether to keep the bad file
  following processing. Defaults to yes (1).
* keep_discardfile. Optional. Whether to keep the discard file
  following processing. Defaults to yes (1).
* localize. Optional. Whether to localize (fix for current OS), the
  data file's end-of-line delimiters. Defaults to no (0).
* parameters. Optional. A hashref of SQL*Loader command-line
  parameters (excluding control, log, bad and discard)

run

Invoke the SQL*Loader run. Will return a code, that is an integer between 0 and 3:

* 0 - successful 
* 1 - failed 
* 2 - warn 
* 3 - fatal

Examples

* All rows loader successfully - 0 
* All/some rows discarded      - 2 
* All/some row rejected        - 2 
* Discontinued load            - 2 
* Command line/syntax errors   - 1 
* Errors Fatal to Sql*Loader   - 1 
* OS related errors            - 3

command

Return the constructed SQL*Loader command - the sqlldr invocation and the user authentication information if not included

controlfile_content

Return the content of the controlfile

error

Return any error generated following the SQL*Loader run

output

Return the output from a SQL*Loader run

LICENSE AND COPYRIGHT

Copyright 2010 Redbone Systems Ltd

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

The terms are in the LICENSE file that accompanies this application