Beruflich Dokumente
Kultur Dokumente
2002 George R Lewycky keywords: oracle, financials, receivables, customer interface, sql*loader, sqlldr, customer data Email: grlewycky@yahoo.com www : http://georgenet.net/oracle
Customer Interface also ensures that records marked for insertions are unique and that the updates exist. The same applies to the updates which must pre-exist.
Table of Contents Introduction and Overview What is needed, Preliminary Set Up and Special SQL functions
Postal Code, Address Validation Automatic Customer and Site Numbering Default Profile Class & Profile Class Amounts How to acquire the valid values for Country Codes Quickcodes: Customer Category, Class, Type, Site Use Code Creating a duplicate TABLE of an existing Table Copying the data from one TABLE to another DELETE ALL ROWS (RECORDS) FROM THE TABLE
Truncating trailing spaces from the Name Validating record inserted using SQL*Plus Customer Interface tables and their destination table(s)
Creating Data and Control files for SQL*LOADER Other Tips and Procedures Useful Excel macro to create custom delimiter Creating a copy of an existing table to test with Comma Delimited a SQL statement to extract data
Data tips Cleaning up your customer file (removing old, redundant data) Transform all data into uppercase Remove special characters such as and , else extracts, etc. Will become troublesome
Customer Interface What it does Limitations Reporting Error Handling Setup values
Creating a duplicate TABLE of an existing Table Copying the data from one TABLE to another DELETE ALL ROWS (RECORDS) FROM THE TABLE
SQL> select territory_code||','||nls_territory from fnd_territories 2 order by nls_territory; TERRITORY_CODE||','||NLS_TERRITOR --------------------------------DZ,ALGERIA US,AMERICA AU,AUSTRALIA AT,AUSTRIA BH,BAHRAIN BD,BANGLADESH BE,BELGIUM BR,BRAZIL BG,BULGARIA CA,CANADA CN,CHINA RU,CIS HR,CROATIA CY,CYPRUS CZ,CZECH REPUBLIC
The following is needed on the PC you are working on: 1. 2. 3. 4. SQL*PLUS SQLLDR.EXE (DOS program on the Server machine)
.ctl
file containing the SQL*LOADER code files containing data which matches the fields in SQL*Loader
Try to use NOTEPAD or WORKPAD as your editor for these files. NOTE: keep the sqlldr.exe or sqlload.exe (dos program) and the data and control (.ctl) files all in the same directory to simplify locating and updating files and reading errors, etc. Copy the dos program from the server box.
SETUP
SYSTEM
SYSTEM OPTIONS
TAX
1. Postal Code range from 00000 99999-9999 or from 00000 ZZZZZ-ZZZZ 2.Address Validation set to:
(if international)
NO VALIDATION
If you dont turn off address validation you will be compounded with these messages in the error report for each customer record. Oracle should just default to address validation to OFF.
address reference has 2 different countries address reference has 2 different addr1 values address reference has 2 different cities address reference has 2 different postal codes address reference has 2 different states address reference has 2 identical site use codes address reference has 2 different customers
SETUP 1. 2.
SYSTEM
SYSTEM OPTIONS
CHECK the box AUTOMATIC CUSTOMER NUMBERING CHECK the box AUTO SITE NUMBERING
CUSTOMERS
PROFILE CLASSES
Using the Profile Class DEFAULT as shown below populate the Following fields with the values shown: Payment Terms Days in Period 30 Net 30
NOTE: the box at the top right identifies DEFAULT as the profile to be used for Interface process
10
Now click on the Profile Class Amounts tab and in the first empty box under the Currency heading choose your desired currency from the pop up list.
11
Use this SQL code to derive Oracles country codes you must use in your COUNTRY column shown above.
12
Example:
SQL>
13
14
15
Click the FLASHLIGHT ICON on the upper right corner and then a pop-up box appears. Type the word customer in front of the % to perform a string search for all the customer related variables as shown below.
16
SQL> / CREATED_BY ---------1013 1013 1013 1013 1013 1 1013 1013 1013 1013 1013 CREATED_BY ---------1013 1013 1013 1013 1013 1013 1013 1013 LOOKUP_TYPE -----------------------------CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY LOOKUP_TYPE -----------------------------CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY LOOKUP_CODE -----------------------------BOE CON ED CON ED & LEGAL CON ED-LEGAL CONTRACTOR CUSTOMER DDC DEP-LEGAL DEVELOPER DOT DOT-LEGAL LOOKUP_CODE -----------------------------FARE MEDIA FARE MEDIA-OTHER LEGAL LIB-FARE MEDIA LIRR-FARE MEDIA MNRR-FARE MEDIA MTA METRO-NORTH LOCK. MTA-B&T-OTHER
17
1013 CUSTOMER_CATEGORY 1013 CUSTOMER_CATEGORY 1013 CUSTOMER_CATEGORY CREATED_BY ---------1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 1013 CREATED_BY ---------1013 1013 1013 1013 1013 1 1013 1 1 1 1 1 1 1 CREATED_BY ---------1 1 1 1 1 1 1 1 1 1 1 1 1 LOOKUP_TYPE -----------------------------CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY LOOKUP_TYPE -----------------------------CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_CATEGORY CUSTOMER_OR_VENDOR CUSTOMER_OR_VENDOR CUSTOMER_OR_VENDOR CUSTOMER_PROSPECT_CODE CUSTOMER_PROSPECT_CODE CUSTOMER_PROSPECT_CODE CUSTOMER_RANK LOOKUP_TYPE -----------------------------CUSTOMER_RANK CUSTOMER_RANK CUSTOMER_RANK CUSTOMER_RANK CUSTOMER_STATUS CUSTOMER_STATUS CUSTOMER_STATUS CUSTOMER_STATUS CUSTOMER_STATUS CUSTOMER_TYPE CUSTOMER_TYPE CUSTOMER_TYPE CUSTOMER_TYPE
MTA-HDQ-LOCK MTA-HDQ-OTHER MTA-HDQ-RENT & CONCESS LOOKUP_CODE -----------------------------MTA-LIB-LOCK. MTA-LIB-OTHER MTA-LIRR-FARE MEDIA MTA-LIRR-LOCK MTA-LIRR-OTHER NYC DDC NYC DEP NYC DEP-LEGAL NYC DOT NYS-DOT OTHER LOOKUP_CODE -----------------------------OTHER-CON EDISON LEGAL OTHER-LEGAL PARATRANSIT PARKS POLICE PROSPECT SCRAP SALES BOTH CUSTOMER VENDOR CUSTOMER NEITHER PROSPECT 1 LOOKUP_CODE -----------------------------2 3 4 5 A I X A I I R SPONSOR STUDENT
109 rows selected. select lookup_type,lookup_code,end_date_active from fnd_lookup_values_vl where (lookup_type between 'CUSTOMER_' and 'CUSTOMER_X') order by lookup_type, end_date_active
18
SQL> ED Wrote file afiedt.buf select created_by,lookup_type,lookup_code from fnd_lookup_values_vl where lookup_type between 'CUSTOMER' and 'CUSTOMER_' SQL> / CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ----------------------------1013 CUSTOMER CLASS MTA 1013 CUSTOMER CLASS NYC 1013 CUSTOMER CLASS OTHER 1 CUSTOMER CLASS PUBLIC SECTOR COMPANIES
19
LOOKUP_TYPE LOOKUP_CODE ------------------------------ --------------------------SITE_USE_CODE ACK SITE_USE_CODE BILL_TO SITE_USE_CODE BOL SITE_USE_CODE CM SITE_USE_CODE DELIVER_TO SITE_USE_CODE DRAWEE SITE_USE_CODE DUN SITE_USE_CODE INV SITE_USE_CODE LEGAL SITE_USE_CODE MARKET SITE_USE_CODE SHIP_TO LOOKUP_TYPE LOOKUP_CODE ------------------------------ --------------------------SITE_USE_CODE SOLD_TO SITE_USE_CODE STMTS 13 rows selected. SQL> ED Wrote file afiedt.buf 1 select lookup_type,lookup_code from ar_lookups 2* where lookup_type='SITE_USE_CODE' SQL>
20
If you are loading Contact information (phone number and contact person) via the Customer Interface you will need to ADD TELEPHONE_TYPE to AR_LOOKUPS and add codes such as VOICE and FAX which correspond to the required data in the
RA_CONTACT_PHONES_INT_ALL table as shown below in the sample record and sqlldr code
"1","2377","12377","I","CORNELIUS","SIGETY","212","410-8789","27-Jun-03","-1","27-Jun03","-1","CUST","5000","CUST5000","PHONE","PHONE5000","CONT","CONT5000","VOICE
LOAD DATA INFILE 'phone0603.txt' insert INTO TABLE RA_CONTACT_PHONES_INT_ALL FIELDS TERMINATED BY '","' (AGENCY_SKIP FILLER, CUST_SKIP FILLER, ORIG_SYSTEM_CUSTOMER_REF, INSERT_UPDATE_FLAG, CONTACT_FIRST_NAME, CONTACT_LAST_NAME, TELEPHONE_AREA_CODE, TELEPHONE, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, CUST_SKIP1 FILLER, CUST_SKIP2 FILLER, ORIG_SYSTEM_ADDRESS_REF, CUST_SKIP3 FILLER, ORIG_SYSTEM_TELEPHONE_REF, TELEPHONE_TYPE)
21
How to execute SQL*LOADER Run your MS-DOS prompt using the Command Prompt as shown below: You cannot run this DOS program through the START RUN method!!!!!
22
Create a single directory, which contains the following: 1. sqlldr.exe you might need to COPY it from the SERVER box NOTE: You need SQL*PLUS installed and configured on your machine or simply Run from the server box 2. all your data files delimited and formatted for SQL*LOADER filename must match the filenames listed in the .CTL code run below Try to create a delimeter such as , Example. First Name,Last Name,Phone, using a comma might not be unique or sufficient for your data. Ive seen some people using ] also 3. all your SQL*LOADER code to load the data files into the interface tables NOTE: all code must end in .CTL 4. SQL*Plus
23
24
LOAD DATA
INFILE 'C:\MY SQL\cust_apr30.txt dont ask me why you might need to fully re-type this line,
Re-typing the line seems to fix the problem and load data
25
Enter SQL*PLUS and validate the record count and perform a commit transaction:
The following is needed on the PC you are working on: 5. 6. SQL*PLUS SQLLDR.EXE (DOS program on the Server machine)
Click on the ICON to start SQL PLUS or run through your START menu
Shortcut to Sqlplusw.lnk
In this example enter the following in lowercase: Username Password Host string apps apps vis Vision db or the name of your instance
NOTE: this matches the sqlldr screen print shown below: apps/apps@vis is all one word!!!!
26
after the sql loader is finished, start sql*plus and then enter (this is so that the Transaction is finalized) then validate the record count as shown below: the commands you enter are in BOLD
Oracle8i Enterprise Edition Release 8.1.7.1.1 - Production With the Partitioning option JServer Release 8.1.7.1.1 - Production SQL> commit; Commit complete.
commit;
as shown below;
SQL> select count(*) from ra_customers_interface_all; COUNT(*) ---------1 1* select count(*) from RA_CUSTOMER_PROFILES_INTERFACE SQL> / COUNT(*) ---------2 SQL>
27
Truncating trailing spaces from Customer Name If your upload file has fixed length fields and particularly the NAME field has trailing spaces you will need to REMOVE these trailing spaces BEFORE you run the interface otherwise searching customers will encounter problems. Example: 1. 2. ABC Co is not the same as ABC Co Log into SQL*PLUS run the following SQL code
COMMIT;
NOTE: If you have to do this after the Customer Interface took place use this SQL code
COMMIT;
Example of fixed Length DATA:
9306","BILL CLINTON ","106 9307","NY CITY TRANSIT ","107 9308","LARRY ELLISONS YACHT ","108 9309","MAD SCIENTIST YADA 9309","109 CRAZY CRAZY CRAZY CRAZY AVE AVE AVE AVE "," "," "," "," "," "," "," ","
NOTE: THESE FIXED FILES ARE MUCH EASIER TO CREATE and READ
TEXT WRITE PROGRAM (excel macro) http://tushar-mehta.com/excel/software/text_write_program/index.html has a real useful Macro Text Write Program to delimit , for a text file to be loaded into oracle using SQL, etc Excel will only do commas !!! 28
9306","BILL CLINTON ","106 9307","NY CITY TRANSIT ","107 9308","LARRY ELLISONS YACHT ","108 9309","MAD SCIENTIST YADA 9309","109 blank line blank line
end of file
The flat ASCII text file containing your data should not: Contain extra spaces at then end of any line Contain blank lines before the EOF (end of file) is reached, otherwise record counts will be misleading along with error messages.
29
Customer Interface Validation Rules The Customer Interface program validates the data you load in the Customer Interface tables by ensuring that the columns in the interface tables reference the appropriate values and columns in the rest of the system. The interface supports the same data relationship for customer information as the customer window. If you are trying to perform updates, Customer Interface ensures that the record to be updated either already exists within the system or is in the interface table in the insert mode. Additionally, Customer Interface ensures that certain column values are consistent with each other. For example, if a profile class is not assigned to a customer, the interface program ensures that interest charge, collector, discount terms, and other profile class information is defined in the appropriate columns. Customer Interface also ensures that records marked for insertion are unique This process is a cumbersome trial and error process. With misleading and convoluted error messages.
RA_CUSTOMERS_INTERFACE Requirements
To import a customer, address, or business purpose, populate the following mandatory columns of RA_CUSTOMERS_INTERFACE:
o o o o o o o o o
ORIG_SYSTEM_CUSTOMER_REF INSERT_UPDATE_FLAG CUSTOMER_NAME CUSTOMER_NUMBER (if you are not using Automatic Customer Numbering) CUSTOMER_STATUS LAST_UPDATED_BY LAST_UPDATE_DATE CREATED_BY 7CREATION_DATE
If you are importing an address and a business purpose, you must also populate the following tables:
o o o o o
PRIMARY_SITE_USE_FLAG (If you are inserting an address) LOCATION (If you are not using Automatic Site Numbering) SITE_USE_CODE (If you are inserting an address) ADDRESS1 ORIG_SYSTEM_ADDRESS_REF 30
The header section displays the date and the time that Customer Interface began processing your transactions. The date is displayed in the format DD-MON-YY, while the time is displayed in the 24-hour format (so that 2:30 PM displays as 14:30). The header section also displays the concurrent request ID used by the Concurrent Manager and the user ID of the person who submitted the Concurrent Request. The Summary of Transfer section displays a count of the customer information processed for each of the tables updated by the interface program. The Exception Records Section displays detailed error messages for each record in each interface tables not successfully processed. This section also displays the original system reference columns from the interface tables to help you identify and correct exception records.
31
After Successfully running the Customer Interface the data is moved from to/from the tables upon which tables you populate FROM:
RA_CUSTOMERS_ALL
TO:
HZ_PARTIES HZ_PERSON_PROFILES HZ_ORGANIZATIONS_PROFILES HZ_CUSTOMER_ACCOUNTS HZ_PARTY_SITES HZ_LOCATIONS HZ_CUST_ACCT_SITES_ALL HZ_CONTACT_POINTS HZ_CUST_CONTACT_POINTS HZ_CUST_ACCCOUNT_ROLES HZ_ORG_CONTACTS HZ_PARTIES HZ_PARTY_RELATIONSHIPS HZ_ROLE_RESPONSIBILITY HZ_CUST_ACCT_RELATE_ALL HZ_CUST_SITE_USES_ALL HZ_CUSTOMER_PROFILE_CLASSES HZ_CUST_PROF_CLASS_AMOUNTS HZ_CUSTOMER_PROFILES HZ_CUSTOMER_PROFILE_AMOUNTS
RA_ADDRESSES_ALL
RA_PHONES RA_CONTACTS
For the interface to work at a bare minimum you need RA_CUSTOMERS_ALL & RA_ADDRESSES_ALL populated with the correct data before running the interface
32
Below is a Cross-Reference table of the current A/R Customer file extract against the Oracle Interface table
Create a cross reference table of Oracles fields versus your fields. Especially note the NOT NULL fields which must be given values even if the field has no use to you.
Notes
Description
Length
Null/Not Null
4 digit number
ORIG_SYSTEM_CUSTOMER_REF
VARCHAR2
240
NOT NULL
"I"
INSERT_UPDATE_FLAG CUSTOMER_NAME
VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 NUMBER DATE NUMBER DATE
NOT NULL NOT NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NOT NULL NOT NULL
Oracle will create To be determined To be determined Address Line 1 Address Line 2 Address Line 3 Address Line 4 City State "USA" 95% data if applicable if applicable
CUSTOMER_NUMBER CUSTOMER_STATUS CUSTOMER_TYPE ADDRESS1 ADDRESS2 ADDRESS3 ADDRESS4 CITY STATE COUNTRY LAST_UPDATED_BY
date entered
LAST_UPDATE_DATE CREATED_BY
15
date entered
CREATION_DATE
NOTE: Where NOT NULL is given a value must be given for the record
33
Control =
Loadtbag.ctl is shown below: load data infile 'c:\MY SQL\oracust.txt' flat file of the DATA !!!! replace replace or append into table tbagcust Oracle table created above fields terminated by '","' delimiter (AUTH,CUST, NAME, all fields ADDRESS1,ADDRESS2,ADDRESS3,ADDRESS4, CITYCOUNTRY,STATE,ZIP,PHONE,CONTACT,DATEADDED )
sample of the data file NOTE: the first field DOESNT have , preceding it, only succeeding it !!!!!! This is due to fields terminated by '","' which is the delimiter separating the fields just like we do for spreadsheets
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 ********************************* Top of Data ********************************** 1","0066","ABC BUS MANUFACTURING ","1506 30TH STREET ","NORTHWEST 1","0068","ABC RAIL PRODUCTS CORP. ","11TH & WASHINGTON STREETS"," 1","0070","ABCO REFRIGERATION SUPPLY","49-70 31ST STREET "," 1","0090","ABEE PRINTING CORP. ","305-1 KNICKERBOCKER AVE. ","
If you use append data must already be on the table Other options were explored for loading this data and SQL*Loader was found to be the most effective for the amount of data being processed.
Useful Excel Macro to delimit , - note Excel alone wont allow such a delimiter
TEXT WRITE PROGRAM (excel macro) http://tushar-mehta.com/excel/software/text_write_program/index.html has a real useful Macro Text Write Program to delimit , for a text file to be loaded into oracle using SQL, etc Excel will only do commas !!! 34
How to execute SQL*LOADER Run your MS-DOS prompt using the Command Prompt as shown below: You cannot run this DOS program through the START RUN method!!!!!
35
Create a single directory, which contains the following: 4. sqlldr.exe you might need to COPY it from the SERVER box NOTE: You need SQL*PLUS installed and configured on your machine or simply Run from the server box 5. all your data files delimited and formatted for SQL*LOADER filename must match the filenames listed in the .CTL code run below Try to create a delimeter such as , Example. First Name,Last Name,Phone, using a comma might not be unique or sufficient for your data. Ive seen some people using ] also 6. all your SQL*LOADER code to load the data files into the interface tables NOTE: all code must end in .CTL 4. SQL*Plus
36
37
38
Before you run the Interface Customer you should run SQL*Plus and count the amount of records in the tables you uploaded the data into. Note after you run a successful Customer Interface Oracle will automatically delete all the records you uploaded.
39
Procedure for invoking the Oracle Interface Processing after the data has been loaded into the RA_CUSTOMER_INTERFACE_ALL table
Within Oracle A/R choose the Interface sub-menu and then choose Customer so that Oracle can insert (or update), process, validate and spread out the data into numerous tables automatically
After selecting Customer another screen will then appear as shown on the next page
40
This screen now appears to port the file into Oracles interface table
41
The following is needed on the PC you are working on: SQL*PLUS SQLLDR.EXE (DOS program on the Server machine)
Shortcut to Sqlplusw.lnk
In this example enter the following in lowercase: Username Password Host string apps apps vis Vision db
NOTE: this matches the sqlldr screen print shown below: apps/apps@vis is all one word!!!!
42
43
44
Example:
SQL>
45
46
47
Use this SQL code: select territory_code,nls_territory from fnd_territories order by nls_territory
SQL> / TE NLS_TERRITORY -- -----------------------------DZ ALGERIA US AMERICA AU AUSTRALIA AT AUSTRIA BH BAHRAIN BD BANGLADESH BE BELGIUM BR BRAZIL BG BULGARIA CA CANADA CN CHINA
48
How to STRING 2 or more columns together. You might have to merge two fields together as shown below. Columns S and T form column U. This is needed for Oracles use for the ORIG_SYSTEM_ADDRESS_REF field.
=S1&&T1
For more info use EXCELs HELP look for: About joining text and values in multiple cells
49
KEEP ALL THESE FILES AND THE PROGRAM ALL IN THE SAME DIRECTORY
50
51
loadracust2.ctl
LOAD DATA INFILE 'abagcus2.txt' DATA FILE!!!!!!!!!!!!!!!!!!!!!!!!! replace INTO TABLE RA_CUSTOMERS_INTERFACE_ALL ****** see below FIELDS TERMINATED BY '","' TRAILING NULLCOLS ( ORIG_SYSTEM_CUSTOMER_REF,CUSTOMER_NAME,ADDRESS1, ADDRESS2,ADDRESS3,ADDRESS4,CITY,STATE, POSTAL_CODE,COUNTRY,INSERT_UPDATE_FLAG, LAST_UPDATED_BY, LAST_UPDATE_DATE, CREATED_BY,CREATION_DATE,CUSTOMER_CATEGORY_CODE, CUSTOMER_STATUS,ORIG_SYSTEM_ADDRESS_REF, PRIMARY_SITE_USE_FLAG,SITE_USE_CODE, CUSTOMER_TYPE )
loadraprof3.ctl
LOAD DATA INFILE 'abagprof2.txt' data file replace INTO TABLE RA_CUSTOMER_PROFILES_INT_ALL FIELDS TERMINATED BY '","' TRAILING NULLCOLS ( ORIG_SYSTEM_CUSTOMER_REF, INSERT_UPDATE_FLAG, CREDIT_HOLD, LAST_UPDATED_BY, LAST_UPDATE_DATE, CREATED_BY,CREATION_DATE, ORIG_SYSTEM_ADDRESS_REF, CUSTOMER_PROFILE_CLASS_NAME )
52
loadrainv.ctl LOAD DATA INFILE 'annainv0812.txt' replace INTO TABLE RA_INTERFACE_LINES_ALL FIELDS TERMINATED BY '","' TRAILING NULLCOLS (ORIG_SYSTEM_BILL_CUSTOMER_REF, AMOUNT,BATCH_SOURCE_NAME,SET_OF_BOOKS_ID,LINE_TYPE, DESCRIPTION,CURRENCY_CODE,CONVERSION_TYPE, INTERFACE_LINE_ID,INTERFACE_LINE_CONTEXT )
loadraerr.ctl LOAD DATA INFILE 'annaerror.txt' replace INTO TABLE RA_INTERFACE_ERRORS_ALL FIELDS TERMINATED BY '","' TRAILING NULLCOLS (INTERFACE_LINE_ID )
loadradist.ctl LOAD DATA INFILE 'annadist.txt' replace INTO TABLE RA_INTERFACE_DISTRIBUTIONS_ALL FIELDS TERMINATED BY '","' TRAILING NULLCOLS (INTERFACE_LINE_ID,INTERFACE_LINE_CONTEXT,ACCOUNT_CLASS )
53
12000","I","N","-1","15-AUG-02","-1","15-AUG-02","","DEFAULT"," 12000","I","N","-1","15-AUG-02","-1","15-AUG-02","CUST2001","DEFAULT","
note the following: the end of each RECORD must end in , end of each column (field) is separated with a , the start of each RECORD is just the data the delimiter specified in the sqlloader code is first used between the first and 2nd field (column)
Creating Comma Delimited File If you are on a legacy mainframe system I suggest using SYNCSORT/DFSORT to pull desired fields into a fixed flat file. Only problem you might have are extra trailing spaces that can pose a problem with the name field, etc. o Also you might be able to generate unique sequence numbers for use by Oracle Use Excel, Lotus, Quattro to produce a spreadsheet of data with a unique delimiter.
54
How to STRING 2 or more columns together. You might have to merge two fields together as shown below. Columns S and T form column U. This is needed for Oracles use for the ORIG_SYSTEM_ADDRESS_REF field.
=S1&&T1
For more info use EXCELs HELP look for: About joining text and values in multiple cells
55
56
3.
57
DOS> sqlldr apps/apps@argt CONTROL FILENAME CONTROL FILENAME IS THE CODE CONTAINING THE COLUMNS, TABLENAME BEING LOADED ( .ctl ) EX. Sqlldr apps/apps@argt loadracust2
58
NOW WHAT??????
After it runs ok you will see commit point appearing for breakpoints indicating Records went through YOU SHOULD CHECK THE .log files
Loadracust2.log
SQL*Loader: Release 8.1.7.0.0 - Production on Mon Aug 26 10:23:59 2002 (c) Copyright 2000 Oracle Corporation. Control File: loadracust2.ctl Data File: abagcus2.txt Bad File: abagcus2.bad Discard File: none specified (Allow all discards) Number to load: Number to skip: Errors allowed: Bind array: Continuation: Path used: ALL 0 50 64 rows, maximum of 65536 bytes none specified Conventional All rights reserved.
Table "AR"."RA_CUSTOMERS_INTERFACE_ALL", loaded from every logical record. Insert option in effect for this table: REPLACE TRAILING NULLCOLS option in effect Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- -------------------ORIG_SYSTEM_CUSTOMER_REF FIRST * CHARACTER Terminator string : '","' CUSTOMER_NAME NEXT * CHARACTER Terminator string : '","' ADDRESS1 NEXT * CHARACTER Terminator string : '","' ADDRESS2 NEXT * CHARACTER Terminator string : '","' ADDRESS3 NEXT * CHARACTER Terminator string : '","' ADDRESS4 NEXT * CHARACTER Terminator string : '","' CITY NEXT * CHARACTER Terminator string : '","' STATE NEXT * CHARACTER Terminator string : '","' POSTAL_CODE NEXT * CHARACTER Terminator string : '","' COUNTRY NEXT * CHARACTER Terminator string : '","' INSERT_UPDATE_FLAG NEXT * CHARACTER Terminator string : '","' LAST_UPDATED_BY NEXT * CHARACTER
59
Terminator string : LAST_UPDATE_DATE Terminator string : CREATED_BY Terminator string : CREATION_DATE Terminator string : CUSTOMER_CATEGORY_CODE Terminator string : CUSTOMER_STATUS Terminator string : ORIG_SYSTEM_ADDRESS_REF Terminator string : PRIMARY_SITE_USE_FLAG Terminator string : SITE_USE_CODE Terminator string : CUSTOMER_TYPE Terminator string :
'","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' NEXT '","' * CHARACTER * CHARACTER * CHARACTER * CHARACTER * CHARACTER * CHARACTER * CHARACTER * CHARACTER * CHARACTER
Table "AR"."RA_CUSTOMERS_INTERFACE_ALL":
0
0
Run began on Mon Aug 26 10:23:59 2002 Run ended on Mon Aug 26 10:24:03 2002 Elapsed time was: CPU time was: 00:00:03.62 00:00:00.19
Then you can run your interface, etc. The amount loaded should equal the amount read.
60
ra_customers_interface_all;
change to appropriate
NOTE: THIS APPLIES TO ALL INTERFACE TABLES!!!!!!!!!!!!!!! EACH TABLE HAS THIS FIELD
Metalink, and search for Document ID: 1073634.6 Doc ID: Note:1073634.6
61
Find the DOS program SQLLDR.EXE you might have to copy it from your server machine and onto your PC where you are loading the data from. Resides in the bin directory. Do a file search in Windows for that exact filename. Enter sqlldr.exe | more to see the commands http://ugweb.cs.ualberta.ca/~c391/manual/chapt5.html VERY GOOD!!!!
http://utenti.lycos.it/yanorel4/1/ch25.htm Que: Using oracle 8Chapter 25 Using SQL*Loader and Export/Import http://www.smckearney.com/oracle/sqlloader.php
GOOD EXAMPLE!
NOTE: If using Excel save spreadsheet at CSV to create comma delimited file
SQL*LOADER ERROR LISTING: http://storacle.princeton.edu:9001/oracle8-doc/server.805/a58312/newch73.htm http://info-it.umsystem.edu/oradocs/doc/server/doc/MSG73/ch7.htm http://wpi.wpi.edu/server.815/a67792/ch07.htm LOG FILE
62
63