clob到xmltype:将“转换为”e

时间:2017-08-29 06:47:09

标签: oracle plsql xmltype

我在plsql中将clob转换为xmltype,如下所示。 $('body').on('focus',".datepicker", function(){ if( $(this).hasClass('hasDatepicker') === false ) { $(this).datepicker({ minViewMode: 2, format: 'yyyy' }); } });

输入变量包含以下文字

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<input type="text" class="datepicker" />

xmltype转换后,文本更改为xml xmltype := xmltype(Input);

当尝试从xmltype中提取xml时,我需要将文本提取为<request xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <comment>Hello, this is "james"</comment> </request>

2 个答案:

答案 0 :(得分:0)

Xmlcast

select xmlcast(xmltype('<request xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <comment>Hello, this is "james"</comment>
</request>').extract('/request/comment/text()') as varchar2(100) ) from dual;

答案 1 :(得分:0)

只需像这样指定字符集:XMLTYPE(Input,NLS_CHARSET_ID('AL32UTF8'))

相关问题