Beruflich Dokumente
Kultur Dokumente
Document ID:
140121.1
Subject:
SOLUTIONS TO COMMON SQL*LOADER QUESTIONS
Last Modified:
11 February 1995
Author:
Unknown
_______________________________________________________________________________
SOLUTIONS TO COMMON SQL*LOADER QUESTIONS
This article describes a number of common questions on SQL*Loader, and gives
simple examples which solve these common issues.
===================================================
============================
IMPLIED DECIMAL PLACES
===================================================
============================
1. How do you load an implied decimal place into the database?
Example:
=======
Let us take an example of a bank account, the data contains a transaction
type, an account number, and a dollar amount. The last column is a
numeric value with an implied decimal place (100.73, 75.25, and 20.00):
DEPOSIT
10015 10073
DEPOSIT
10020 7525
WITHDRAWAL 10015 2000
We want to load the data into the following table:
SQL> CREATE TABLE register
2 (tx_type CHAR(15),
3 acct NUMBER,
4 amt NUMBER);
The control file would look like:
LOAD DATA
INFILE 'month.dat'
INTO TABLE register
(tx_type POSITION(1:10),
acct POSITION(13:17),
amt
POSITION(20:24) ":amt/100"
)
After we run SQL*Loader, our table data looks like:
SQL> SELECT * FROM register;
TX_TYPE
ACCT
AMT
--------------- ---------- ----------
10015
100.73
10020
75.25
10015
20
DATA1 DATA2
USERNAME
DATA1 DATA2
-------------- ---------- --------------JACK
11111 AAAAAAAAAA
JACK
22222 BBBBBBBBBB
How this works:
==============
SQL*Loader simply builds an insert statement which looks like:
INSERT INTO load_user_delimited (data1,data2,seq_number)
VALUES (:data1, :data2, "user");
See chapter 6 of the Utilities Guide "Applying SQL Operators to Fields".
Restrictions:
============
Both of these methods cannot be used with DIRECT PATH Loader.