mungthewicked
Programmer
I've been pounding my fists trying to solve this problem. I'm simply trying to take an Excel(Office 2000) file and import it into a table within Oracle. I'm using 10g client and Toad 9.7.2.5. I've converted the .xls file into a CSV file and a tab-delimited txt file and tried to import both(on separate occasions). Both means have failed. I think I'm close. I've followed this thread( for inspiration.
The method of importing I've been trying is Toad's SQL*Loader Wizard. I need to use the Wizard, because I'll have to show other programmers here in the future how to accomplish this task.
I'll post my attempt using the tab-delimited text file.
Here is the log file produced after I finish the Wizard:
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Feb 12 16:12:44 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: C:\Documents and Settings\harrisc7\Desktop\TextToOracle.ctl
Data File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).txt
Bad File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).bad
Discard File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).dsc
(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 "EZSDBO"."APPOINTMENT", loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
ID FIRST 4 INTEGER
DONOR_ID NEXT 4 INTEGER
APPOINTMENT_TYPE_ID NEXT 4 INTEGER
APPOINTMENT_DATETIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
NUMBER_OF_CHILDREN NEXT * WHT CHARACTER
DONOR_CHECKED_IN NEXT * WHT CHARACTER
APPOINTMENT_STATUS_ID NEXT * WHT CHARACTER
OVERRIDE_ID NEXT * WHT CHARACTER
SCHEDULED_FROM_CENTER_FLAG NEXT * WHT CHARACTER
INSERTED_BY_USER_ID NEXT * WHT CHARACTER
INSERTED_DATE_TIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
UPDATED_BY_USER_ID NEXT * WHT CHARACTER
UPDATED_DATE_TIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
RECORD_VERSION NEXT * WHT CHARACTER
Record 1: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 2: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 3: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 4: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 5: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 6: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 7: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 8: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 9: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 10: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 11: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 12: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 13: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 14: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 15: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 16: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 17: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 18: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 19: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 20: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 21: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 22: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 23: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 24: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 25: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Table "EZSDBO"."APPOINTMENT":
0 Rows successfully loaded.
25 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 182400 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 25
Total logical records rejected: 25
Total logical records discarded: 0
Run began on Thu Feb 12 16:12:44 2009
Run ended on Thu Feb 12 16:12:45 2009
Elapsed time was: 00:00:00.52
CPU time was: 00:00:00.05
The table I'm trying to import into is called APPOINTMENT
Here's the layout of the table (Col names and constraints):
Column Name Null? Data Type
ID Y INTEGER
DONOR_ID Y INTEGER
APPOINTMENT_TYPE_ID Y INTEGER
APPOINTMENT_DATETIME Y TIMESTAMP(6)
NUMBER_OF_CHILDREN Y INTEGER
DONOR_CHECKED_IN Y VARCHAR2 (1 Byte)
APPOINTMENT_STATUS_ID Y INTEGER
OVERRIDE_ID Y INTEGER
SCHEDULED_FROM_CENTER_FLAG Y VARCHAR2 (1 Byte)
INSERTED_BY_USER_ID Y INTEGER
INSERTED_DATE_TIME Y TIMESTAMP(6)
UPDATED_BY_USER_ID Y INTEGER
UPDATED_DATE_TIME Y TIMESTAMP(6)
RECORD_VERSION Y INTEGER
I've successfully executed an INSERT statement into this table:
INSERT INTO APPOINTMENT
VALUES ( (SELECT MAX(ID) FROM APPOINTMENT) + 1, 987, 1, to_timestamp('2/13/2009 11:00:00.000000 AM', 'MM/DD/YYYY HH:MI:SS.FF AM') , 0, 'N', 1, NULL, 'N', 2, to_timestamp('2/11/2009 2:38:12.000000 PM', 'MM/DD/YYYY HH:MI:SS.FF AM'), NULL, NULL, 1)
Once I got this INSERT statement to successfully work, I realized there was a problem with the timestamp(6) columns. I was getting the same error message when I initially attempted the INSERT statement.
Here's my control file:
LOAD DATA
INFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).txt'
BADFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).bad'
DISCARDFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).dsc'
APPEND
INTO TABLE "EZSDBO"."APPOINTMENT"
FIELDS TERMINATED BY X'9'
(ID INTEGER,
DONOR_ID INTEGER,
APPOINTMENT_TYPE_ID INTEGER,
APPOINTMENT_DATETIME TIMESTAMP,
NUMBER_OF_CHILDREN,
DONOR_CHECKED_IN,
APPOINTMENT_STATUS_ID,
OVERRIDE_ID,
SCHEDULED_FROM_CENTER_FLAG,
INSERTED_BY_USER_ID,
INSERTED_DATE_TIME TIMESTAMP,
UPDATED_BY_USER_ID,
UPDATED_DATE_TIME TIMESTAMP,
RECORD_VERSION)
Now, I know I'm missing something because in that other thread that I referenced, there was a format next to TIMESTAMP within the control file.
So far, everything in the Wizard looks fine except for the portion that says Field mapping. The Preview fields tab shows the first 4 columns being populated and that's it. The 4th column is the first column that contains a timestamp(6).
Like I said, I think I'm close. What am I doing wrong? Accurate help is desperately needed. Thank you in advance. Hopefully, there will be more thank you's to come.
The method of importing I've been trying is Toad's SQL*Loader Wizard. I need to use the Wizard, because I'll have to show other programmers here in the future how to accomplish this task.
I'll post my attempt using the tab-delimited text file.
Here is the log file produced after I finish the Wizard:
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Feb 12 16:12:44 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: C:\Documents and Settings\harrisc7\Desktop\TextToOracle.ctl
Data File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).txt
Bad File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).bad
Discard File: C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).dsc
(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 "EZSDBO"."APPOINTMENT", loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
ID FIRST 4 INTEGER
DONOR_ID NEXT 4 INTEGER
APPOINTMENT_TYPE_ID NEXT 4 INTEGER
APPOINTMENT_DATETIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
NUMBER_OF_CHILDREN NEXT * WHT CHARACTER
DONOR_CHECKED_IN NEXT * WHT CHARACTER
APPOINTMENT_STATUS_ID NEXT * WHT CHARACTER
OVERRIDE_ID NEXT * WHT CHARACTER
SCHEDULED_FROM_CENTER_FLAG NEXT * WHT CHARACTER
INSERTED_BY_USER_ID NEXT * WHT CHARACTER
INSERTED_DATE_TIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
UPDATED_BY_USER_ID NEXT * WHT CHARACTER
UPDATED_DATE_TIME NEXT * WHT DATETIME DD-MON-RR HH.MI.SSXFF AM
RECORD_VERSION NEXT * WHT CHARACTER
Record 1: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 2: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 3: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 4: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 5: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 6: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 7: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 8: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 9: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 10: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 11: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 12: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 13: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 14: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 15: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 16: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 17: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 18: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 19: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 20: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 21: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 22: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 23: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 24: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Record 25: Rejected - Error on table "EZSDBO"."APPOINTMENT", column APPOINTMENT_DATETIME.
ORA-01843: not a valid month
Table "EZSDBO"."APPOINTMENT":
0 Rows successfully loaded.
25 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 182400 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 25
Total logical records rejected: 25
Total logical records discarded: 0
Run began on Thu Feb 12 16:12:44 2009
Run ended on Thu Feb 12 16:12:45 2009
Elapsed time was: 00:00:00.52
CPU time was: 00:00:00.05
The table I'm trying to import into is called APPOINTMENT
Here's the layout of the table (Col names and constraints):
Column Name Null? Data Type
ID Y INTEGER
DONOR_ID Y INTEGER
APPOINTMENT_TYPE_ID Y INTEGER
APPOINTMENT_DATETIME Y TIMESTAMP(6)
NUMBER_OF_CHILDREN Y INTEGER
DONOR_CHECKED_IN Y VARCHAR2 (1 Byte)
APPOINTMENT_STATUS_ID Y INTEGER
OVERRIDE_ID Y INTEGER
SCHEDULED_FROM_CENTER_FLAG Y VARCHAR2 (1 Byte)
INSERTED_BY_USER_ID Y INTEGER
INSERTED_DATE_TIME Y TIMESTAMP(6)
UPDATED_BY_USER_ID Y INTEGER
UPDATED_DATE_TIME Y TIMESTAMP(6)
RECORD_VERSION Y INTEGER
I've successfully executed an INSERT statement into this table:
INSERT INTO APPOINTMENT
VALUES ( (SELECT MAX(ID) FROM APPOINTMENT) + 1, 987, 1, to_timestamp('2/13/2009 11:00:00.000000 AM', 'MM/DD/YYYY HH:MI:SS.FF AM') , 0, 'N', 1, NULL, 'N', 2, to_timestamp('2/11/2009 2:38:12.000000 PM', 'MM/DD/YYYY HH:MI:SS.FF AM'), NULL, NULL, 1)
Once I got this INSERT statement to successfully work, I realized there was a problem with the timestamp(6) columns. I was getting the same error message when I initially attempted the INSERT statement.
Here's my control file:
LOAD DATA
INFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).txt'
BADFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).bad'
DISCARDFILE 'C:\Documents and Settings\harrisc7\Desktop\Report Data(Edited).dsc'
APPEND
INTO TABLE "EZSDBO"."APPOINTMENT"
FIELDS TERMINATED BY X'9'
(ID INTEGER,
DONOR_ID INTEGER,
APPOINTMENT_TYPE_ID INTEGER,
APPOINTMENT_DATETIME TIMESTAMP,
NUMBER_OF_CHILDREN,
DONOR_CHECKED_IN,
APPOINTMENT_STATUS_ID,
OVERRIDE_ID,
SCHEDULED_FROM_CENTER_FLAG,
INSERTED_BY_USER_ID,
INSERTED_DATE_TIME TIMESTAMP,
UPDATED_BY_USER_ID,
UPDATED_DATE_TIME TIMESTAMP,
RECORD_VERSION)
Now, I know I'm missing something because in that other thread that I referenced, there was a format next to TIMESTAMP within the control file.
So far, everything in the Wizard looks fine except for the portion that says Field mapping. The Preview fields tab shows the first 4 columns being populated and that's it. The 4th column is the first column that contains a timestamp(6).
Like I said, I think I'm close. What am I doing wrong? Accurate help is desperately needed. Thank you in advance. Hopefully, there will be more thank you's to come.