# 22. Virtuoso Functions Guide - encode_base64

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
encode_base64
split_and_decode
uudecode
uuencode
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## encode_base64

base64-encode/decode a string
decode_base64 (in str varchar);
encode_base64 (in str varchar);
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.

Description

These functions convert strings from/to base64-encoding.

Examples
Simple Example

Base64-encode a string

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

    UnV0YWJhZ2E=

    1 Rows. -- 25 msec.

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