Solved

SQL Loader Issues

Posted on 2004-09-01
1
888 Views
Last Modified: 2013-12-11
I am having problems to load the next record:

more FAMA.dat
Fac.SQLL|1|DESCRIPCIÓN SQL|31-DEC-02|2002/12/01
00:00:00|1000|0|0|5|1063|32|1000|31-DEC-02||||2|||||||||||||||1|2|3|4|5|6|7|Y
ES|A9|A10|A11|A12|13|14|YES|0|A17|11|12|12|112|12|YES|A24|A25|A26|A27|21|21|21

Part of my control file looks like:

LOAD DATA
APPEND
INTO TABLE FA_MASS_ADDITIONS
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
INVOICE_NUMBER CHAR,
FIXED_ASSETS_UNITS      CONSTANT        '1',
DESCRIPTION     CHAR,
DATE_PLACED_IN_SERVICE  DATE    "DD-MON-RR", <---"Here is the error"
GLOBAL_ATTRIBUTE1 DATE 'YYYY/MM/DD HH:MM:SS',
FIXED_ASSETS_COST,
DEPRN_RESERVE,
YTD_DEPRN,
ASSET_CATEGORY_ID,
EXPENSE_CODE_COMBINATION_ID,


The log file says:

DATE_PLACED_IN_SERVICE               NEXT     *   |       DATE DD-MON-RR  ......

Record 1: Rejected - Error on table "FA"."FA_MASS_ADDITIONS", column
DATE_PLACED_IN_SERVICE.
ORA-01858: a non-numeric character was found where a numeric was expected.

I have verified this column and it is a DATE format.

Any help will be really appreciated.

TIA.
0
Comment
Question by:ramaswamymorla
1 Comment
 
LVL 1

Accepted Solution

by:
bestoracleexpert earned 150 total points
ID: 11951509
I recreate the table with all "big varchar2's" -- 25 looks big enough here:

ops$tkyte@ORA920>
ops$tkyte@ORA920> create table t
  2  ( c1 varchar2(25),
  3    c2 varchar2(25),
  4    c3 varchar2(25),
  5    c4 varchar2(25),
  6    c5 varchar2(25),
  7    c6 varchar2(25),
  8    c7 varchar2(25),
  9    c8 varchar2(25),
 10    c9 varchar2(25)
 11  )
 12  /
 
Table created.


and then i load a bad record.  In your case, I used:


ops$tkyte@ORA920> !cat test.ctl
LOAD DATA
infile *
APPEND
INTO TABLE T
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
( c1,
  c2 constant '1',
  c3,
  c4,
  c5,
  c6,
  c7,
  c8,
  c9 )
begindata
Fac.SQLL|1|DESCRIPCIÓN SQL|31-DEC-02|2002/12/01
00:00:00|1000|0|0|5|1063|32|1000|31-DEC-02|


now, when I load that -- i see:


ops$tkyte@ORA920> @printtbl8 'select * from t'
C1                            : Fac.SQLL
C2                            : 1
C3                            : 1
C4                            : DESCRIPCISN SQL
C5                            : 31-DEC-02
C6                            : 2002/12/01 00:00:00
C7                            : 1000
C8                            : 0
C9                            : 0
-----------------
 
PL/SQL procedure successfully completed.


so, you should be able to see the issue now -- that constant doesn't "skip"
a column -- it just stuffed a constant in there.  your fields don't line up at
all.  Your date is in column 5 -- not column 4.  So, you can:

ops$tkyte@ORA920> !cat test.ctl
LOAD DATA
infile *
replace
INTO TABLE T
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
( c1,
  foo filler,
  c3,
  c4,
  c5,
  c6,
  c7,
  c8,
  c9,
  c2 constant '1')
begindata
Fac.SQLL|1|DESCRIPCIÓN SQL|31-DEC-02|2002/12/01
00:00:00|1000|0|0|5|1063|32|1000|31-DEC-02|

ops$tkyte@ORA920> !sqlldr / test
 
SQL*Loader: Release 9.2.0.3.0 - Production on Sat Sep 6 13:04:42 2003
 
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
 
Commit point reached - logical record count 1
 
ops$tkyte@ORA920> @printtbl8 'select * from t';
C1                            : Fac.SQLL
C2                            : 1
C3                            : DESCRIPCISN SQL
C4                            : 31-DEC-02
C5                            : 2002/12/01 00:00:00
C6                            : 1000
C7                            : 0
C8                            : 0
C9                            : 5
-----------------
 
PL/SQL procedure successfully completed.

and now, they'll be in the right place
 
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to recover a database from a user managed backup

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question