Hitachi

Hitachi Advanced Database Setup and Operation Guide


11.15.2 Data retrieval method

Execute the SELECT statement with the ADB_CSVREAD function specified to retrieve data in the CSV files.

Example:

This example retrieves data in the following CSV files that have been compressed into GZIP format:

  • /dir/file1.csv.gz

  • /dir/file2.csv.gz

  • /dir/file3.csv.gz

SELECT * FROM TABLE(ADB_CSVREAD(
              MULTISET['/dir/file1.csv.gz','/dir/file2.csv.gz','/dir/file3.csv.gz'],
             'COMPRESSION_FORMAT=GZIP;
              FIELD_NUM=1,2;
              ENCLOSING_CHAR=";
              DELIMITER_CHAR=,;'))
         AS "T1" ("C1" INTEGER, "C2" VARCHAR(32))
Explanation

This example specifies the absolute path names of the CSV files in the MULTISET argument (underlined portion) of the ADB_CSVREAD function. For details about other arguments and how to specify the ADB_CSVREAD function, see ADB_CSVREAD function in System-defined functions in Constituent Elements in the manual HADB SQL Reference.

Important

When an SQL statement that specifies the ADB_CSVREAD function is executed, the HADB server opens the specified CSV files and reads the data in the files. You must not edit the CSV files while the SQL statement is executing.

Note
  • When data in CSV files is read, one processing real thread is allocated per CSV file.

  • You can also use a table subquery to specify the CSV files that are specified in the ADB_CSVREAD function. For details, see ADB_CSVREAD function in System-defined functions in Constituent Elements in the manual HADB SQL Reference.