Control Characters
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Control Characters

  1. #1
    Join Date
    Jan 2001
    Posts
    515
    I am testing a varchar2 that is about 1000 bytes long. I am trying to check for any control characters(characters that would not be able to be displayed on the screen). Any ideas?

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    If by control character you mean characters with ASCII codes between 0 and 31 then the following query will find all records where col1 contains any of such characters:

    SELECT * FROM my_tab
    WHERE INSTR (TRANSLATE
    (
    col1,
    CHR(1)||CHR(2)||...||CHR(30)||CHR(31),
    CHR(0)||CHR(0)||...||CHR(0)||CHR(0)
    )
    CHR(0)) > 0);

    This efectually translates all characters below ASCII code 32 to a character ASCII 0 by using TRANSLATE and then searches for any occurence of such character with ASCII code 0 by using INSTR.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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



Click Here to Expand Forum to Full Width