Home » RDBMS Server » Server Utilities » SQLLDR: load data in additional columns
SQLLDR: load data in additional columns [message #147546] Fri, 18 November 2005 03:04 Go to next message
hfbm2004
Messages: 8
Registered: November 2005
Junior Member
Hi,

It's required to load data into a table with two additional columns.
1. In-File:

1;A;AAA
2;B;BBB
3;C;CCC

2. control file

load data
infile 'C:\myinfile.csv'
into table mytable
fields terminated by ";"
( id,name,name_original,code,code_original)

I want to load the second columen in IN-file into name and name_original and the third column of IN-file into columns code,code_original.

Regards

Tarlanim
Re: SQLLDR: load data in additional columns [message #147613 is a reply to message #147546] Fri, 18 November 2005 09:34 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
oracle@mutation#desc mutation scott.mytable

Table:scott.mytable
           Name                      Null?    Type
           ------------------------- -------- ------------------------
    1      ID                                 NUMBER
    2      NAME                               VARCHAR2(10)
    3      NAME_ORIGINAL                      VARCHAR2(10)
    4      CODE                               VARCHAR2(10)
    5      CODE_ORIGINAL                      VARCHAR2(10)

oracle@mutation#query mutation scott.mytable

no rows selected

oracle@mutation#cat myctl.ctl
LOAD DATA
INFILE 'myinfile.csv'
append
INTO TABLE mytable
fields terminated by ';' optionally enclosed by '"' trailing nullcols
(id,
name,
code,
name_original ":name",
code_original ":code")
oracle@mutation#cat myinfile.csv
1;A;AAA
2;B;BBB
3;C;CCC
oracle@mutation#sqlldr userid=scott/tiger control=myctl.ctl

SQL*Loader: Release 9.2.0.4.0 - Production on Fri Nov 18 09:33:23 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Commit point reached - logical record count 3
oracle@mutation#query mutation scott.mytable

        ID NAME       NAME_ORIGI CODE       CODE_ORIGI
---------- ---------- ---------- ---------- ----------
         1 A          A          AAA        AAA
         2 B          B          BBB        BBB
         3 C          C          CCC        CCC

Re: SQLLDR: load data in additional columns [message #147781 is a reply to message #147613] Mon, 21 November 2005 01:01 Go to previous message
hfbm2004
Messages: 8
Registered: November 2005
Junior Member
Thanks for respondig. It works.

Tarlanim
Previous Topic: Any way to import an external database without Oracle Utilties such as Import?
Next Topic: sqlldr program
Goto Forum:
  


Current Time: Tue Jul 02 05:05:15 CDT 2024