Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: RE: Find an unprintable character inside a column....

RE: RE: Find an unprintable character inside a column....

From: Robson, Peter <pgro_at_bgs.ac.uk>
Date: Fri, 10 Oct 2003 04:12:07 -0800
Message-ID: <F001.005D2B45.20031010041207@fatcity.com>


Some people have requested this code, so I thought you might as well all have the chance to pick it to bits... Its a function called BAD_ASCII, and it hunts out for any ascii characters with an ascii value of less than 32 in a specified field. (Acknowledgments to my colleague Keith Holmes for help with this code.)

Use it as follows:

Where a field called DATA in a table TABLE_1 may contain an ascci character with a value less than 32 (ie a non-printing character), the following SQL will find the row in question:

select rowid,DATA,dump(DATA) from TABLE_1 where BAD_ASCII(DATA) > 0;

You could use the PK of the table instead of rowid, of course. You will also note that I select the DATA field in both normal and ascii 'dump' mode, the better to locate where the corruption is located.

peter
edinburgh

...................................

Source as follows:

Function BAD_ASCII
 (V_Text in char)
 return number
is
 V_Int number;
 V_Count number;
begin

--
V_Int   := 0;
V_Count := 1;
while V_Count<=length(rtrim(V_Text)) and V_Int=0
 loop
  if ascii(substr(V_Text, V_Count, 1))<32 then
   V_Int := V_Count;
  end if;
 V_Count := V_Count + 1;
end loop;
return V_Int;
--
exception
  when others then
    return -1;
end BAD_ASCII;
/

------------------------------------------


> -----Original Message-----
> From: Prem Khanna J [mailto:jprem_at_kssnet.co.jp]
> Sent: Thursday, October 09, 2003 10:49 AM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: RE: Find an unprintable character inside a column....
>
>
> Peter, i would be interested in that.
> can u mail it to me ?
>
> Jp.
>
> 09-10-2003 18:29:33, "Robson, Peter" <pgro_at_bgs.ac.uk> wrote:
> >I have a small PL/SQL piece of code used to detect these
> things, if anyone
> >wants it.
>
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Prem Khanna J
> INET: jprem_at_kssnet.co.jp
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
********************************************************************* This e-mail message, and any files transmitted with it, are confidential and intended solely for the use of the addressee. If this message was not addressed to you, you have received it in error and any copying, distribution or other use of any part of it is strictly prohibited. Any views or opinions presented are solely those of the sender and do not necessarily represent those of the British Geological Survey. The security of e-mail communication cannot be guaranteed and the BGS accepts no liability for claims arising as a result of the use of this medium to transmit messages from or to the BGS. . http://www.bgs.ac.uk ********************************************************************* -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Robson, Peter INET: pgro_at_bgs.ac.uk Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Fri Oct 10 2003 - 07:12:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US