Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Loader Date issue csv to Oracle

3413453Apr 11 2017 — edited Apr 11 2017

Table trying to get data to: CREATE TABLE REVENUE_FACT_TABLE 

Maybe my Orcale table date format causing issue?

SQL Loader  CSV to Oracle

I have 3 Tables total

my biggest problem is date format

Here the csv table for REVENUE_FACT_TABLE 

   

Customer_KeyDateItem_KeyAmountQuantity
11101/Jan/2004110001
33301/Jan/200423001
22201/Jan/200433001
11101/Jan/20044201
33301/Jan/20045201
33301/Jan/2004631
11101/Jan/20047123
33301/Jan/2004891
33301/Jan/20049111
22201/Jan/20041091
CC101/Jan/20041135001
CC205/Jan/20041222001

Other two CSV at end

Here the ctl file

load data

infile 'Merge_2.csv' "str '\r\n'"

append

into table REVENUE_FACT_TABLE

fields terminated by ','

OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS

(Customer_Key CHAR,

REVENUE_DATE CHAR,

Item_Key CHAR,

Amount CHAR,

Quantity CHAR

)

Error log

SQL*Loader: Release 11.2.0.2.0 - Production on Tue Apr 11 01:09:36 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Control File:   merge_2.ctl

Data File:      Merge_2.csv

  File processing option string: "str '\r\n'"

  Bad File:     Merge_2.bad

  Discard File:  none specified

(Allow all discards)

Number to load: ALL

Number to skip: 0

Errors allowed: 50

Bind array:     64 rows, maximum of 256000 bytes

Continuation:    none specified

Path used:      Conventional

Table REVENUE_FACT_TABLE, loaded from every logical record.

Insert option in effect for this table: APPEND

TRAILING NULLCOLS option in effect

   Column Name                  Position   Len  Term Encl Datatype

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

CUSTOMER_KEY                        FIRST     *   ,  O(") CHARACTER           

REVENUE_DATE                         NEXT     *   ,  O(") CHARACTER           

ITEM_KEY                             NEXT     *   ,  O(") CHARACTER           

AMOUNT                               NEXT     *   ,  O(") CHARACTER           

QUANTITY                             NEXT     *   ,  O(") CHARACTER           

Record 14: Discarded - all columns null.

Record 1: Rejected - Error on table REVENUE_FACT_TABLE, column REVENUE_DATE.

ORA-01858: a non-numeric character was found where a numeric was expected

Record 2: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 3: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 4: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 5: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 6: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 7: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 8: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 9: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 10: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 11: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 12: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Record 13: Rejected - Error on table REVENUE_FACT_TABLE.

ORA-00001: unique constraint (PROZEE.SYS_C007941) violated

Table REVENUE_FACT_TABLE:

  0 Rows successfully loaded.

  13 Rows not loaded due to data errors.

  0 Rows not loaded because all WHEN clauses were failed.

  1 Row not loaded because all fields were null.

Space allocated for bind array:                  82560 bytes(64 rows)

Read   buffer bytes: 1048576

Total logical records skipped:          0

Total logical records read:            14

Total logical records rejected:        13

Total logical records discarded:        1

Run began on Tue Apr 11 01:09:36 2017

Run ended on Tue Apr 11 01:09:37 2017

Elapsed time was:     00:00:01.05

CPU time was:         00:00:00.03

Space allocated for bind array:                  82560 bytes(64 rows)

Read   buffer bytes: 1048576

Create Tables

CREATE TABLE ITEM 

Item_Key NUMBER(5) NOT NULL, 

Item_MshpId  VARCHAR(5) NULL, 

Item_ID VARCHAR(15) NULL, 

Item_Category  VARCHAR(25) NULL, 

Item_Type VARCHAR(25) NULL, 

PRIMARY KEY (Item_Key) 

); 

 

CREATE TABLE CUSTOMER 

Customer_Key VARCHAR(15) NOT NULL, 

CustomerFName VARCHAR(26) NULL,  

CustomerLName VARCHAR(26) NULL, 

Custcategory VARCHAR(26) NULL, 

CustState CHAR(20) NULL, 

CustZip VARCHAR(10) NULL, 

PRIMARY KEY (Customer_Key) 

); 

 

CREATE TABLE REVENUE_FACT_TABLE 

Customer_Key VARCHAR(15) NOT NULL,  

REVENUE_DATE DATE NULL,  

Item_Key NUMBER(5) NOT NULL, 

Amount NUMBER(10,4) NULL,  

Quantity INT  NULL, 

FOREIGN KEY (Item_Key) REFERENCES Item (Item_Key), 

CONSTRAINT CUST_FK FOREIGN KEY (Customer_Key) REFERENCES CUSTOMER (Customer_Key), 

PRIMARY KEY(Customer_Key,Item_Key) 

); 

CSV

  ITEM table

Item_KeyItem_MshpIdMshpNameItem_CategoryItem_Type
1M1PlatnumMEMBERSHIP
2M2GoldMEMBERSHIP
3M3ValueMEMBERSHIP
4PSAAdultONE DAY PASS CATEGORY1-001
5PSSSeniorONE DAY PASS CATEGORY1-003
6PSKKidONE DAY PASS CATEGORY1-002
7EQ1Jump RopeMERCHANDISE11113
8AP2HatMERCHANDISE11111
9AP1T-shirtMERCHANDISE11111
10AP2HatMERCHANDISE11112
11L-AAll Day RentalEvent
12L-HHalf Day RentalEvent

Customer

     

Customer_KeyCustomerFNameCustomerLNameCustStateCustZip
111Joe50611
333Sue60611
222Mary50640
CC1Sears Chicago60640
CC2BoeingChicago60611
This post has been answered by KayK on Apr 11 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2017
Added on Apr 11 2017
3 comments
1,345 views