Difference between revisions of "SQL - Encode/decode function (base64)"
Jump to navigation
Jump to search
(Created page with "<code> set define off; </code> - Encode<br/> <code>SELECT UTL_RAW.cast_to_varchar2(</code><br/> <code>UTL_ENCODE.base64_encode(</code><br/> <code>UTL_...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <syntaxhighlight lang="sql"> | ||
set define off; | set define off; | ||
</ | </syntaxhighlight> | ||
- Encode< | - Encode | ||
<syntaxhighlight lang="sql"> | |||
SELECT UTL_RAW.cast_to_varchar2( | |||
UTL_ENCODE.base64_encode( | |||
UTL_RAW.cast_to_raw('Surf the world, travel & eat as much as u can... xo xo T.'))) "42" | |||
FROM dual; | |||
</syntaxhighlight> | |||
- Decode | |||
- Decode< | <syntaxhighlight lang="sql"> | ||
SELECT UTL_RAW.cast_to_varchar2( | |||
UTL_encode.base64_decode( | |||
UTL_RAW.cast_to_raw('U3VyZiB0aGUgd29ybGQsIGxvdmUgdGhlIHdvbWVuLCBlYXQgYXMgbXVjaCBhcyB1IGNhbi4uLiB4byB4byBULg=='))) "42" | |||
FROM dual; | |||
</syntaxhighlight> |
Latest revision as of 10:14, 13 April 2018
set define off;
- Encode
SELECT UTL_RAW.cast_to_varchar2(
UTL_ENCODE.base64_encode(
UTL_RAW.cast_to_raw('Surf the world, travel & eat as much as u can... xo xo T.'))) "42"
FROM dual;
- Decode
SELECT UTL_RAW.cast_to_varchar2(
UTL_encode.base64_decode(
UTL_RAW.cast_to_raw('U3VyZiB0aGUgd29ybGQsIGxvdmUgdGhlIHdvbWVuLCBlYXQgYXMgbXVjaCBhcyB1IGNhbi4uLiB4byB4byBULg=='))) "42"
FROM dual;