Skip to content

Instantly share code, notes, and snippets.

@foobarbaz-pl
Last active April 20, 2024 07:21
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save foobarbaz-pl/4100b45ac1ff60dd2a6c8dda993470bc to your computer and use it in GitHub Desktop.
Save foobarbaz-pl/4100b45ac1ff60dd2a6c8dda993470bc to your computer and use it in GitHub Desktop.
[PL/SQL Base64 encode decode] #oracle
declare
r raw(32767);
begin
r := utl_raw.cast_to_raw('Test');
dbms_output.put_line(r);
r := utl_encode.base64_encode(r);
dbms_output.put_line(utl_raw.cast_to_varchar2(r));
r := utl_encode.base64_decode(r);
dbms_output.put_line(utl_raw.cast_to_varchar2(r));
end;
/
select utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw('Aladdin:open sesame')))
from dual;
select utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw('QWxhZGRpbjpvcGVuIHNlc2FtZQ==')))
from dual;
@javier50024
Copy link

THANKS!!!!!! i love this.

@sanjaysen9377
Copy link

will this work for large string like CLOB types ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment