Hi,
use double single quote, like this:

        'SELECT * FROM existingCustomers where name = ''a'' ',

regards
Dario


El 18/11/10 03:50, vijay escribió:
> Hi,
>
> I have a table as below.
> CREATE TABLE If not exists test
> (
>       ID                      NUMBER(5)     NOT NULL,
>       NAME                    varchar(20),
> ) ;
>
>
> I am trying to use csvwrite to write the contents of the table to a
> file. But when I use the following csvwrite query, I am getting the
> below syntax error.
> call csvwrite('/opt/dump.csv', 'SELECT * FROM TEST where name='a'');
> Syntax error in SQL statement "CALL CSVWRITE('/opt/dump.csv', 'SELECT
> * FROM TEST where name='A[*]'') "; expected ")"; SQL statement:
> call csvwrite('/opt/dump.csv', 'SELECT * FROM TEST where name='a'')
> [42001-132] 42001/42001 (Help)
>
> when I try to execute the query alone , it works fine.
> SELECT * FROM TEST where name='a';
> ID    NAME
> 1     a
> (1 row, 15 ms)
>
>
> I am suspecting something I am doing wrong with escape sequence. Even
> I tried the following two querirs using "escape" keyword also. But no
> success.
> call csvwrite('/opt/dump.csv', 'SELECT * FROM TEST where name=\'a\'
> escape '\'');
> Syntax error in SQL statement "CALL CSVWRITE('/opt/dump.csv', 'SELECT
> * FROM TEST where name=\'A[*]\' escape '\'') "; expected ")"; SQL
> statement:
> call csvwrite('/opt/dump.csv', 'SELECT * FROM TEST where name=\'a\'
> escape '\'') [42001-132] 42001/42001 (Help)
>
> Can you please help me in correcting this query?
>
> Thanks in advance,
> Vijay
>

-- 
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