## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> TRIM[TRIM]:::quoted TRIM --> End((END)) ``` ## Purpose The `TRIM` SQL function trims whitespaces from both sides of the provided text. See also [[LTRIM]] and [[RTRIM]]. Parameters: - Input (`varchar2`): the text from which to trim characters. - Characters (optional, `varchar2`): the characters to trim; defaults to whitespace. Returns: A text trimmed from whitespaces from both sides. ## Examples The following example trims the whitespace from both sides of ` abcd `: ```sql select trim(' abcd ') ------------------- abcd ``` The following example retrieves `null` since the input contains only whitespace: ```sql select trim(' ') ------------------- ``` The following example trims the characters `:`, `,`, `.`, `[`, `]` and whitespace from both sides of the input: ```sql select trim(':,[] hi []:', ': ,.[] ') ------------------- hi ```