Top

Name

csv_cols_def — Guess columns and column types from CSV file.

Synopsis

csv_cols_def ( in file_name varchar );
 

Description

This function will try to guess the columns by given CSV file. It would work if CSV file begins with a header row.

Parameters

file_name

The name of the CSV file.

Examples

Example 24.130. Simple Use

SQL>create procedure my_csv_get_columns (in file_name varchar)
{
   dbg_obj_print(csv_cols_def(file_name));
}
;

Done. -- 10 msec.

SQL>select my_csv_get_columns('tmp/MyContacts.csv');
callret
VARCHAR
______________________

0

1 Rows. -- 10 msec.
-- and on the Virtuoso Server console will be shown:

(('First_Name_Last_Name_Middle_Name_Name_Nickname_E_mail_Address_Home_Street_Home_City_Home_Postal_Code_Home_State_Home_Country_Region_Home_Phone_Home
_Fax_Mobile_Phone_Personal_Web_Page_Business_Street_Business_City_Business_Postal_Code_Business_State_Business_Country_Region_Business_Web_Page_Busine
ss_Phone_Business_Fax_Pager_Company_Job_Title_Department_Office_Location_Notes' 'VARCHAR' ) )