2013年3月5日火曜日

oracle xmltypeとextract()とgetClobVal()


軽くハマったのでメモ。

Oracle11gにて。

select x.xmltype_column.extract('/root/temp/text()').getClobVal() from hoge_table x
where
 xmlid = 'test_xml'

extract()を使う場合、上記のように hoge_table x と別名をつけて x.xmltype_column.extract(...と書かないとエラーになるらしい。

下のSQLで動かずにちょっと悩んだ。

エラーになるパターン

select xmltype_column.extract('/root/temp/text()').getClobVal() from hoge_table
where
 xmlid = 'test_xml'


0 件のコメント:

コメントを投稿