# 22. Virtuoso Functions Guide - blob_to_string

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
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
ascii
atoi
blob_to_string
blob_to_string_outpu...
chr
initcap
isblob
isstring
lcase
left
length
locate
ltrim
make_string
regexp_instr
regexp_like
regexp_match
regexp_parse
regexp_replace
regexp_substr
repeat
replace
right
rtrim
search_excerpt
serialize
space
split_and_decode
sprintf
strcasestr
strchr
string_output
string_output_flush
string_output_gz_com...
string_output_string
string_to_file
strrchr
strstr
subseq
substring
tmp_file_name
trim
ucase
upper
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

## blob_to_string

Convert a blob to string
varchar blob_to_string (in blobany);
Description

Although primarily used for converting blobs (long varbinary, long varchar) to string, blob_to_string may also be used to convert from wide string, persistent XML (XPER) and string_output streams. If the data being converted is longer than maximum length of a string, blob_to_string will signal an error.

Note

This function is equivalent to cast (x as varchar). Using cast is preferred.

Parameters
blob – blob handle (long varbinary or long varchar), string_output or XPER (persistent XML)
Return Types

Varchar contents of blob.

Errors

SQLState | Error Code | Error Message | Description
--- | --- | --- | ---
22023 | SR068 | XML tree cannot be used as argument of blob_to_string |
22001 | SR069 | Attempt to convert a persistent XML document longer than VARCHAR maximum in blob_to_string |
22023 | SR070 | blob_to_string requires a blob as argument |
22023 | SR071 | Blob argument to blob_to_string must be a non-interactive blob |
22001 | SR072 | Blob too long for the string. |

Examples
Various conversions

    SQL> use Demo;

    Done. -- 20 msec.
    SQL> select blob_to_string (Description) from Categories;
    callret
    VARCHAR
    _______________________________________________________________________________

    Soft drinks, coffees, teas, beers, and ales
    Sweet and savory sauces, relishes, spreads, and seasonings
    Desserts, candies, and sweet breads
    Cheeses
    Breads, crackers, pasta, and cereal
    Prepared meats
    Dried fruit and bean curd
    Seaweed and fish

    8 Rows. -- 37 msec.
    SQL>

See Also

Casting, string_output.