Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Question Unanswered: special character handling

    hi ppl out there

    mi using java, do anyone know how to handle special character for sql?
    doing a project and need help.. thanks alot..

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I guess I don't understand what you mean by "special character" (to me that means certain ASCII values that cause things to happen, like EOL, etc). Can you explain a bit more for me???

    -PatP

  3. #3
    Join Date
    Mar 2004
    Posts
    4

    Question special character handling in sql

    hi

    for example, i type select * from user where user='o'connor';
    o'connor is actually one of the data in the database.
    when that query is submited, it return a error:
    Error: Syntax error (missing operator) in query expression 'user ='o'conner';'. (State:37000, Native Code: FFFFF3E4)

    thanks

  4. #4
    Join Date
    Jan 2004
    Posts
    492

    Re: special character handling in sql

    Originally posted by rongfu84
    hi

    for example, i type select * from user where user='o'connor';
    o'connor is actually one of the data in the database.
    when that query is submited, it return a error:
    Error: Syntax error (missing operator) in query expression 'user ='o'conner';'. (State:37000, Native Code: FFFFF3E4)

    thanks
    For single quotes in a string use 2 single quotes together:

    EX:

    'o''connor'

    Note: This is 2 SINGLE quotes, and not 1 double quote.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    So then you mean characters that SQL uses for special purposes, such as the apostrophe? Different dialects of SQL treat different chacters as "special", so you'll really have to read the documentation for the SQL engine that you are using, and follow it's guidlines for how to handle them.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •