Skip to content

Instantly share code, notes, and snippets.

@hemanth22
Forked from foobarbaz-pl/base64.sql
Created May 17, 2021 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemanth22/9ef2a65480d3d64038f7b2d71ef2c890 to your computer and use it in GitHub Desktop.
Save hemanth22/9ef2a65480d3d64038f7b2d71ef2c890 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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment