[
https://issues.apache.org/jira/browse/DERBY-6894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15360680#comment-15360680
]
Bryan Pendleton commented on DERBY-6894:
----------------------------------------
I believe that the idea of the INSERTCOLUMNS and COLUMNINDEXES arguments is
to allow the user to describe how some-or-all of the columns in the input data
are to
be matched up with the same number of columns in the destination table.
So if you specify 5 column names in INSERTCOLUMNS, then you need to also
specify 5 columns in the input data. The data from the first specified column
in the
input data is stored in the first specified column in the table; the data in
the second
is stored in the second, and so forth.
But, except for that, we would like the procedure to be very flexible. The
names of
the columns in the table might be:
CREATE TABLE PETS( nm varchar(100), tp varchar(10), age int );
and the data in the input might be:
Name,Years of Age,kind-of-pet,gender,color
Fluffy,2,bunny,female,white
Spot,7,dog,male,white and black
Chatty,17,Grey Parrot,Female, grey
and to handle that data, you might load the data by specifying
INSERTCOLUMNS => 'NM,TP,AGE'
and
COLUMNINDEXES => '1, "kind-of-pet", "Years of Age"'
So the columns in the input data can be in a different order than the
columns in the destination table, and you can also specify only a subset
of the columns of the input data, and only a subset of the columns in
the destination table, but you have to line things up properly so that
the columns in the two parameters INSERTCOLUMNS and COLUMNINDEXES
are matched up to each other in order.
Does that make sense?
> Enhance COLUMNINDEXES parsing for SYSCS_IMPORT_DATA_BULK to recognize columns
> by name
> -------------------------------------------------------------------------------------
>
> Key: DERBY-6894
> URL: https://issues.apache.org/jira/browse/DERBY-6894
> Project: Derby
> Issue Type: Sub-task
> Components: SQL
> Reporter: Bryan Pendleton
> Assignee: Danoja Dias
> Priority: Minor
> Attachments: Derby-6894.diff, noHeaderLines.csv, repro.java
>
>
> To ease maintainability and legibility of client programs, it would be
> nice if callers of SYSCS_IMPORT_DATA_BULK (and possibly also
> SYSCS_IMPORT_DATA) could refer to columns in the COLUMNINDEXES
> argument by column *NAME*, as well as by index *NUMBER*.
> So, for example, a valid COLUMNINDEXES specification might be:
> '1,3,LastName,FirstName,7'
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)