Name

encode_base64, decode_base64, encode_base64url, decode_base64url — 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.101. Simple Example

Base64-encode a string

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

UnV0YWJhZ2E=

1 Rows. -- 25 msec.
      

Example 24.102. 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


© 1992 - OpenLink Software. All rights reserved.

Making Technology Work for You®