## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> XMLELEMENT[XMLELEMENT]:::quoted
XMLELEMENT --> End((END))
```
## Purpose
The `XMLELEMENT` SQL function formats a value as an XML element with the specified tag name.
See also [[XMLCOMMENT]], [[XMLDECODE]], [[XMLENCODE]], [[XMLFORMAT]] and [[XMLTRANSFORM]].
Parameters:
- Tag (`varchar2`): name of the XML element.
- Value (`varchar2`, `decimal` or `datetime`): value to include in the XML element.
- Show null (optional, `boolean`): whether to return an element with `xsi:nil="true"` for a `null` value (`true`) or `null` (`false`). Defaults to `true`.
Returns: A text with the value formatted as an XML element.
## Examples
The following example formats the text `val` as an XML element with tag name `Tag`:
```sql
select xmlelement('Tag', 'val')
-------------------
<Tag>val</Tag>
```
The following example formats a `null` value as an XML element with tag name `Tag`:
```sql
select xmlelement('Tag', null)
-----------------------------------------------------------------------------
<Tag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
```