Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    2

    Unanswered: Smart Quotes and ascii characters

    Hi - I need to update a VARCHAR2 column in a database and replace all occurances of a particular ascii character with another ascii character. These are not visible in the text as it's stored in the column. What functions can I use to do this type of replacement?

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I'd use an ordinary REPLACE function:

    SELECT REPLACE('IT IS A STRING', CHR(65), CHR(66)) FROM dual;

    It seems that you already know ASCII codes of those characters, so that shouldn't make a problem.

    But, do you really mean "in a database", or is it just a table? If it is a whole database, you'll need a PL/SQL procedure which will loop through all tables and VARCHAR2 columns and - dynamically - using EXECUTE IMMEDIATE perform requested replacements.

    If it is one table and a column, you can do that using an UPDATE statement in SQL.

  3. #3
    Join Date
    Aug 2006
    Posts
    2

    Thanks

    Thanks - that's the function I was looking for. I just need to do an update statement for one table and column.

Posting Permissions

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