Re: need help with txt to oracle import

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Sat, 14 Dec 2002 21:14:45 -0800
Message-ID: <3DFC0FC5.F08562B1_at_exesolutions.com>


user wrote:

> i use sqlldr witht he following in the loader.ctl file
>
> load data
> infile 'D:\college\assignments\359\359database\klse.txt'
> fields terminated by ","
> into table indexs (indate, indexs, volume)
>
> and it gives me the error:
>
> SQL*Loader-350: Syntax error at line 3.
> Expecting keyword INFILE, keyword INTO or end of file, found keyword fields.
> fields terminated by ","
> ^
>
> what is wrong with my code ?
>
> "user" <utagi_at_yahoo.com> wrote in message news:3dfabcf1_2_at_news.tm.net.my...
> > create table Indexs
> > ( indate date not null constraint Index_Date_PK primary key,
> > indexs number(8,2) not null,
> > volume number(8,2) not null);
> >
> > alter session set NLS_DATE_FORMAT='<DD-MM-YY>';
> >
> > THESE ARE THE commands that i run before i import ... the text file
 context
> > is like below:
> >
> > 29-06-00,830.2500, 237.0000
> > 30-06-00,833.3700, 160.0000
> > 03-07-00,793.9300, 104.0000
> > 04-07-00,807.8700, 89.0000
> > 05-07-00,818.6900, 95.0000
> > 06-07-00,815.6800, 95.0000
> > 07-07-00,820.4700, 135.0000
> > 10-07-00,837.5900, 206.0000
> >
> > can anyone tell me how should i import them to my oracle ?
> > i've tried sqlldr , but it seems that my oracle does have it, it says
> > "SP2-0042: unknown command "sqlldr" - rest of line ignored."
> >
> > using oracle8i (8.1.7) personal edition on winxp
> >
> > thanks
> >
>

You need to tell SQL*Loader that your first item is a date and its format.

Try something based on the following demo:

LOAD DATA
INFILE *
APPEND
INTO TABLE emp
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
(empno, ename, job, mgr, hiredate DATE "DD-Month-YYYY", sal, comm, deptno CHAR TERMINATED BY ':', projno, loadseq SEQUENCE(MAX,1))
BEGINDATA

9782,"Clark",Manager",7839, 09-June-2000, 2572.50,, 10:101
9839,"King","President", , 17-November-1999, 5500.00,,10:102
9934,"Miller","Clerk",7782, 23-January-2001, 920.00,, 10:102
9566,"Jones","Manager",7839, 02-April-2001, 3123.75,, 20:101
9499,"Allen","Salesman",7698, 20-February-2001, 1600.00, 300.00, 30:103
9654,"Martin","Salesman",7698, 28-September-2000, 1312.50, 1400.00, 30:103
9658, "Chan", "Analyst", 7566, 03-May-1999, 3450,, 20:101

Daniel Morgan Received on Sun Dec 15 2002 - 06:14:45 CET

Original text of this message