oracle - Unscramble string code in sql -


i have function in oracle sql scrambles given input. need unscramble it.

i need program can reverse output of program below.

source in varchar2 sgarbled varchar2(510); index number; length number; onec number;  begin     length := length(source);     if length > 255     length := 255;       end if;  index := 1;  sgarbled := '';   while index <= length loop     onec := ascii(substr(source, index, 1)) - 30;     if (onec < 10)         sgarbled := sgarbled || '0';         end if;     sgarbled := sgarbled || cast(onec varchar2);     index := index + 1;   end loop;   return sgarbled; end 

it can possible, if allowing character values in original string before scrambling it, characters of alphabet.

code this:

sgarbled in varchar2  unsgarbled varchar2(255);  length number; index number; onec number;  begin length := length(sgarbled); index := 1; unsgarbled := '';   while index <= length loop  onec := substr(sgarbled, index, 1);     if (onec = '0')         onec := substr(sgarbled, (index + 1), 1) + 30;      else          onec := substr(sgarbled, (index), 2) + 30;     end if;     unsgarbled := unsgarbled || cast(chr(onec) varchar2);     index := index + 2;   end loop;   return unsgarbled; end 

as mr. llama pointed out if allowing original input string contain ascii characters may not possible.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -