Hi,
Joe CSV isn't the most suitable format to export/import CLOBs , but if  your 
LOBs  don't are very big and complex  you can do something like this:

In Java use literal  \n \t etc. to construct your string ,
and for parsing and existing csv file,  you would not have any problem to parse 
csv file containing newlines as in next testcase:

------------------------------------------------
create table tlob  ( id identity, memo clob);
insert into tlob values (null,'simple value');
insert into tlob values (null,'L0  --------
L1        kk    
L2 t ó ¬ |
L3 v    " --    
L4 v    ''- ');
call CSVWRITE('~/test.csv', 'SELECT * FROM TLOB', 'UTF-8');
create table tlob2 as (select * from CSVREAD('~/test.csv', null, 'UTF-8'));
SELECT * FROM tlob;
SELECT * FROM tlob2;
drop table tlob;
drop table tlob2;
 -------------------------------------------------

That procude a csv as:

"ID","MEMO"
"1","simple value"
"2","L0  --------
L1        kk     
L2 t ó ¬ |
L3 v    "" --   
L4 v    '- "

as you can see, CSVREAD properly parse the field even with newlines and tabs 
inside.
If you create csv file by hand (in place of using CSVWrite) you must use to 
escape almost delimiter characters like:

    single quote (')    with ('') two single quote.
    and doube quote (")    with ("") two double quote.

and to format your numbers as in US locale without thousands separator.

regards,
Dario

El 10/09/10 07:25, joe escribió:
> I want to load a csv file into H2. Some of the fields in the file are
> CLOBs, and some of those CLOBs have newlines in them.
>
> How do I format the file appropriately so that H2 CSVREAD interprets
> the multiline text CLOBs as single field values?
>
>


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to