SQLite Forum

HEX function returns empty string on null input, normal?
Login
>cuz: I believe the essence here is that hex() is a string function and should/will work always returning a string.

```
.null NULL
select substr(null,1,1);
┌──────────────────┐
│ substr(null,1,1) │
├──────────────────┤
│ NULL             │
└──────────────────┘
```

Isn't substr() also a string function?

>gunter_hick: Nope. From the same page: "Abs(X) returns NULL if X is NULL."

Just like with the `hex()` function, `substr()` [documentation](https://sqlite.org/lang_corefunc.html) does not mention what happens with NULL, so this alone should not be taken to imply that NULL is 'consumed' differently by those functions.