Problem string with literals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ursx
    New Member
    • Sep 2007
    • 1

    Problem string with literals

    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
    Recognized Expert Contributor
    • May 2007
    • 404

    #2
    Ursx,

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

    MODERATOR

    Comment

    • ties
      New Member
      • Nov 2007
      • 6

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

      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

      Comment

      Working...