Skip to content
February 12, 2016 / doganay

REMOVE NON-ALPHA CHARACTERS IN A HEX VARIABLE

a-> 4B414C414E42494C4749789798FD98FF (KALANBILGIx—˜ı˜ÿ)

declare
 a varchar2(4096);
 b varchar2(1);
 c varchar2(4096);
begin
 a:='4B414C414E42494C4749789798FD98FF';
 c:='';
 for i in 1..length(a)
 loop
  b:=utl_raw.cast_to_varchar2(hextoraw(substr(a,i*2-1,2)));
  if (b>='a' and b<='z' or b>='A' and b<='Z')
  then
   c:=c||b;
  end if;
 end loop;
 dbms_output.put_line(c);
end;
/

c-> KALANBILGIx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: