How to map single file(.csv) column to multiple table columns using sqlldr

时间:2017-12-18 07:35:03

标签: oracle sql-loader

I have a file(.csv) contains the columns A1,A2,A3 and Table has the columns T1,T2,T3,T4,T5.

I want to map or insert data from A2 column to T2,T3,T4.I am able to insert into T2 and T3 using desc_skip FILLER POSITION(1) in control file(.ctl) but not in T4. Could you please help me How to insert single file column value into more than Two columns in table using sqlldr.

Please find the control file below which i am using.

<p v-cloak>{{place.images[0]}}</p>

Thanks in Advance.

1 个答案:

答案 0 :(得分:0)

You should use something similar to

    @JsonCreator
    public Location(@JsonProperty("A") String a,
                          @JsonProperty("B") int b,
                          @JsonProperty("C") int b,
                          @JsonProperty("D") int d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }

         public int setNewFiled(int newFiled) {
                   this.newFiled = newFiled;
         }

P.S. I cannot imagine what can 'not working'. My example:

Database:

...
T2 char,
T3 expression ":T2",
T4 expression ":T2",
...

CSV file:

SQL> create table t$loader (t1 varchar2(10), t2 varchar2(10), t3 varchar2(10), t4 varchar2(10), t5 varchar2(10));

Table created

Control file:

echo 1,2,3 > csv.csv
echo 4,5,6 >> csv.csv
echo 7,8,9 >> csv.csv

Run:

load data
  infile 'csv.csv'
  into table t$loader
  fields terminated by ','
(
  t1 char,
  t2 char,
  t3 expression ":t2",
  t4 expression ":t2",
  t5 char
)

Result:

sqlldr userid=user/password@db control=csv.ctl

Isn't it what you ask for?