TO_BINARY
Sintaxis
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> TO_BINARY[TO_BINARY]:::quoted
TO_BINARY --> End((END))
Propósito
La función SQL TO_BINARY convierte un valor en un BLOB. El texto se interpreta como UTF-8.
Véanse también ASCII_TO_BLOB, UNICODE_TO_BLOB y HEX_TO_BLOB.
Parámetros:
- Entrada (
ANY): valor que se va a convertir.
Devuelve: la entrada convertida en un BLOB.
Ejemplos
El siguiente ejemplo convierte el texto hi en un BLOB y recupera la representación en base64:
select base64_encode(to_binary('hi'))
-------------------
aGk=
El siguiente ejemplo convierte el texto abc en un BLOB y recupera la longitud en bytes:
select length(to_binary('abc'))
-------------------
3