Results 1 to 3 of 3

Thread: Problem with single quote in SQL 2K

  1. #1
    Join Date
    Oct 2005
    Posts
    4

    Problem with single quote in SQL 2K

    Hi all,

    I have a problem. I can code to insert a string which has single quote from screen into database. However, when I search from Query in database to find this record, it cannot find the record that I inserted.
    For example: select UserID, Title from WCS_USER
    where Title = ' how're you? '

    Pls guide me how to solve this problem as soon as possible. Thank all of you.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,557
    SQL> create table dbj
    2 (text varchar2(50));

    Table created.

    SQL> insert into dbj values ('Isn'||chr(39)||'t this better?');

    1 row created.

    SQL> select * from dbj;

    TEXT
    --------------------------------------------------
    Isn't this better?

    SQL> select * from dbj
    2 where text = 'Isn\'t this better?';
    ERROR:
    ORA-01756: quoted string not properly terminated

    SQL> select * from dbj
    2 where text = 'Isn''t this better?';

    TEXT
    ------------------------------------------------
    Isn't this better?

  3. #3
    Join Date
    Oct 2005
    Posts
    4
    Thank you so much! I now find out the solution .
    Thanks again

Posting Permissions

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