Name

encode_base64 , decode_base64 — base64-encode/decode a string

Synopsis

encode_base64 ( in str varchar );
 
decode_base64 ( in str varchar );
 

Description

These functions convert strings from/to base64-encoding.

Parameters

str

A varchar value.

Return Values

encode_base64 returns a varchar containing base64-encoded data. decode_base64 returns a varchar containing the result of the base64-decoding.

Examples

Example 24.99. Simple Example

Base64-encode a string

SQL> select encode_base64('Rutabaga');
callret
VARCHAR
_______________________________________________________________________________

UnV0YWJhZ2E=

1 Rows. -- 25 msec.


Example 24.100. Web example

Using encode-base64 with serialize to persist complex data

declare n any; n := vector ('a', 3.14157, 4711, 'Hic Iacet Corpus.');
http (sprintf ('<input type="hidden" name="saved" value="%s">', encode_base64 (serialize (n))));

To retrieve this data in VSP context when handling a form submit:

declare n any; n := deserialize (decode_base64 (get_keyword ('saved', params, '')));


See Also

serialize