TO_BINARY
Sintassi
%%{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))
Scopo
La funzione SQL TO_BINARY converte un valore in un BLOB. Il testo viene interpretato come UTF-8.
Vedi anche ASCII_TO_BLOB, UNICODE_TO_BLOB e HEX_TO_BLOB.
Parametri:
- Input (
ANY): valore da convertire.
Restituisce: il valore di input convertito in un BLOB.
Esempi
L'esempio seguente converte il testo hi in un BLOB e recupera la rappresentazione in base64:
select base64_encode(to_binary('hi'))
-------------------
aGk=
L'esempio seguente converte il testo abc in un BLOB e ne recupera la lunghezza in byte:
select length(to_binary('abc'))
-------------------
3