## Syntax
```mermaid
%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%
flowchart LR
Start((START)) --> NGRAM_DICE[NGRAM_DICE]:::quoted
NGRAM_DICE --> End((END))
```
## Purpose
The `NGRAM_DICE` SQL function says how many runs of n characters two values have in common, on a scale from zero to one. It is [[Invantive UniversalSQL/Grammar/SQL Functions/TRIGRAM_DICE|TRIGRAM_DICE]] with the length of the run left to the caller: a shorter run finds more and is less precise, a longer run the other way round.
Parameters:
- Text 1 (`varchar2`): the first value.
- Text 2 (`varchar2`): the second value.
- Size (`int32`, optional): the length of a run, at least one. Three when it is left out.
Returns: the coefficient as `double`, from zero to one. Returns `null` when one of the values is `null`.
## Examples
The following example compares two values on runs of two characters, of which they share two of three:
```sql
select ngram_dice('abcd', 'abce', 2)
-------------------
0,6666666666666666
```
The following example leaves the length of the run out, which makes it the trigram coefficient:
```sql
select ngram_dice('licence', 'licence')
-------------------
1
```