## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> | | SHORTEN[SHORTEN]:::quoted SHORTEN --> End((END)) ``` ## Purpose The `SHORTEN` SQL function reduces a text to a maximum length. When the text exceeds the maximum length, text is removed from the middle by replacing the removed text by a shorter text. Parameters: - Input (`varchar2`): Text to shorten. - Length (`int32`): Maximum length of the shortened text. - Replacement (optional, `varchar2`): Text to replace the removed text by. Defaults to `...`. Returns: Input shortened to length. ## Examples The following example shortens a text to at most 15 characters: ```sql select shorten('The quick brown fox jumps over the lazy dog', 15) ------------------- The qu...zy dog ``` The following example leaves the text unchanged since it does not exceed the maximum length: ```sql select shorten('The quick brown fox', 50) ------------------- The quick brown fox ```