<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
 "../dtd/reference.dtd">
<!-- 
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at      

http://www.apache.org/licenses/LICENSE-2.0  

Unless required by applicable law or agreed to in writing, software  
distributed under the License is distributed on an "AS IS" BASIS,  
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
See the License for the specific language governing permissions and  
limitations under the License.
-->
<reference id="rrefimporttableprocwithheaderlines" xml:lang="en-us">
<title>SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK system procedure</title>
<shortdesc>The <codeph>SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK</codeph> system procedure supports all
functionalities of <codeph>SYSCS_UTIL.SYSCS_IMPORT_TABLE</codeph> with the additional feature to skip column headers in the input file.
</shortdesc>
<refbody>
<section>
<p><ph conref="../conrefs.dita#prod/productshortname"></ph> issues a COMMIT or a
ROLLBACK statement after each import and export procedure is run (a COMMIT if
the procedure completes successfully, a ROLLBACK if it fails). For this reason,
you should issue either a COMMIT or ROLLBACK statement to complete all
transactions and release all table-level locks before you invoke an import or
export procedure.</p>
<p>For more information on using this procedure, see the section
"Importing and exporting data" in the
<ph conref="../conrefs.dita#pub/citadmin"></ph>.</p>
</section>
<section><title>Syntax</title> <codeblock>SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK (IN SCHEMANAME VARCHAR(128),
IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672),
IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1),
IN CODESET VARCHAR(128), IN REPLACE SMALLINT
IN SKIP SMALLINT)</codeblock> <p>No result is
returned from the procedure.</p> <dl><dlentry>
<dt>SCHEMANAME</dt>
<dd>An input argument of type VARCHAR(128) that specifies the schema of the
table. Passing a NULL value will use the default schema name.</dd>
</dlentry><dlentry>
<dt>TABLENAME</dt>
<dd>An input argument of type VARCHAR (128) that specifies the table name
of the table into which the data is to be imported. This table cannot be a
system table or a declared temporary table. Passing a null will result in
an error.</dd>
</dlentry><dlentry>
<dt>FILENAME</dt>
<dd>An input argument of type VARCHAR(32672) that specifies the file that
contains the data to be imported. If you do not specify a path, the current
working directory is used. Passing a NULL value will result in an error.</dd>
</dlentry><dlentry>
<dt>COLUMNDELIMITER</dt>
<dd>An input argument of type CHAR(1) that specifies a column delimiter. The
specified character is used in place of a comma to signal the end of a column.
Passing a NULL value will use the default value; the default value is a comma
(,).</dd>
</dlentry><dlentry>
<dt>CHARACTERDELIMITER</dt>
<dd>An input argument of type CHAR(1) that specifies a character delimiter.
 The specified character is used in place of double quotation marks to enclose
a character string. Passing a NULL value will use the default value; the default
value is a double quotation mark (").</dd>
</dlentry><dlentry>
<dt>CODESET</dt>
<dd>An input argument of type VARCHAR(128) that specifies the code set of
the data in the input file. The name of the code set should be one of the
Java-supported character encodings. Data is converted from the specified code
set to the database code set (utf-8).  Passing a NULL value will interpret
the data file in the same code set as the JVM in which it is being executed.</dd>
</dlentry><dlentry>
<dt>REPLACE</dt>
<dd>An input argument of type SMALLINT. A non-zero value will run in REPLACE
mode, while a value of zero will run in INSERT mode. REPLACE mode deletes
all existing data from the table by truncating the data object, and inserts
the imported data. The table definition and the index definitions are not
changed. INSERT mode adds the imported data to the table without changing
the existing table data. Passing a NULL will result in an error.</dd>
</dlentry><dlentry>
<dt>SKIP</dt>
<dd>An input argument of type SMALLINT.
SKIP number of header lines will be ignored and rest
of lines in the input file will be imported to the table</dd>
</dlentry></dl>If you create a schema, table, or column name as a non-delimited
identifier, you must pass the name to the import procedure using all uppercase
characters. If you created a schema, table, or column name as a delimited
identifier, you must pass the name to the import procedure using the same
case that was used when it was created.</section>
<section><title>Execute privileges</title>
<p>If authentication and SQL authorization are both enabled, only the
<xref href="rrefattrib26867.dita#rrefattrib26867">database owner</xref> has
execute privileges on this procedure by default. See "Configuring user
authentication" and "Configuring user authorization" in the
<ph conref="../conrefs.dita#pub/citsec"></ph> for more information. The
database owner can grant access to other users. The user must also have INSERT
privileges on the table.</p>
</section>
<section><title>Example</title><p>The following example imports data into
the <codeph>PET</codeph> table from a delimited data file called <codeph>petlist.del</codeph>
Data contained in the input file petlist.del is given below.
<codeblock>
Pet Name,Kind of Animal,Age
Rover,Dog,4
Spot,cat,2
Squawky,Parrot,37
</codeblock>

<codeblock>CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK
(null, 'PET', 'c:/output/petlist.del', null, null, null, 0, 1);</codeblock>

When data is imported from the input file, first line in the input file is ignored.
That is the number of lines given in the SKIP argument. Rest of the lines in the input
file is imported.
This means that first line <codeblock>
Pet Name,Kind of Animal,Age </codeblock>is ignored and other three lines,<codeblock>Rover,Dog,4
Spot,cat,2
Squawky,Parrot,37</codeblock> are imported.</p></section>
</refbody>
</reference>
