Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem string with literals

Newbie
 
Join Date: Sep 2007
Posts: 1
#1: Sep 29 '07
Hi all
i have following problems with literals

id = 1
vname = Maria
lname = D'Alessio


INSERT INTO ADDRESS values( 1,'D'Alessio', 'Maria')

SQLSTATMENT is

STATEMENT = "INSERT INTO ADDRESS" values(",
"'"id"',",
"'"vname"',",
"'"lname"')")"


and receive following error
SQL0010N Error "')' .... SQLSTATE 42603

because of literal D' Alessio

Thanks for help

Purple's Avatar
Moderator
 
Join Date: May 2007
Location: UK - North West
Posts: 385
#2: Oct 4 '07

re: Problem string with literals


Ursx,

I am going to move this post to the forum because you have posted into the articles.

MODERATOR
Newbie
 
Join Date: Nov 2007
Location: Laren, Netherlands
Posts: 6
#3: Nov 2 '07

re: Problem string with literals


If you want to have a single-quote inside a literal string, use two consecutive single quotes, like this:
values( 1,'D''Alessio', 'Maria')

Quote:

Originally Posted by ursx

Hi all
i have following problems with literals

id = 1
vname = Maria
lname = D'Alessio


INSERT INTO ADDRESS values( 1,'D'Alessio', 'Maria')

SQLSTATMENT is

STATEMENT = "INSERT INTO ADDRESS" values(",
"'"id"',",
"'"vname"',",
"'"lname"')")"


and receive following error
SQL0010N Error "')' .... SQLSTATE 42603

because of literal D' Alessio

Thanks for help

Reply