---
title: "XMLFORMAT"
description: "XMLFORMAT SQL\u95A2\u6570\u306F\u3001XML\u30C6\u30AD\u30B9\u30C8\u3092\u6574\u5F62\u3057\u3066\u8868\u793A\u3057\u307E\u3059\u3002"
language: ja
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/ja/docs/invantive-universalsql/grammar/sql-functions/xmlformat
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/xmlformat
updated: 2026-12-04T14:56:13Z
license: https://documentation.invantive.eu/ja/
---

## 構文
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> XMLFORMAT[XMLFORMAT]:::quoted
    XMLFORMAT --> End((END))
```

## 目的
`XMLFORMAT` SQL関数は、XMLテキストを整形して表示します。

関連項目：[[XMLCOMMENT]]、[[XMLDECODE]]、[[XMLELEMENT]]、[[XMLENCODE]]、[[XMLTRANSFORM]]。

パラメータ:
- Xml (`varchar2`): 整形表示するXML。

戻り値: 整形表示されたXMLテキスト。

## 例
次の例では、圧縮されたXMLテキストを整形して表示します:
```sql
select xmlformat('<r><name>peter</name></r>')

-------------------
<?xml version="1.0" encoding="utf-8"?>
<r>
  <name>peter</name>
</r>
```
次の例では、XMLテキストが無効なためエラーが発生します。終了タグ `c` が開始タグ `a` と一致していません:
```sql
select xmlformat('<root><a>b</c></root>')

itgenxml120: XML formatting failed.
```

