Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ORA-31011: XML parsing failed
- ORA-19202: Error occurred in XML processing
- LPX-00244: invalid use of less-than ('<') character (use <)
- Error at line 1
- 31011. 00000 - "XML parsing failed"
- *Cause: XML parser returned an error while trying to parse the document.
- *Action: Check if the document to be parsed is valid.
- create table foo(id int, xml clob, valid int default null);
- insert into foo(id,xml) values (1, '<?xml version="1.0"?><root><a foo="b"></a></root>');
- insert into foo(id,xml) values (2, '<?xml version="1.0"?><root><a foo="<"></a></root>');
- commit;
- create function is_valid_xml(xml_param clob)
- return int
- as
- scratch xmltype;
- begin
- select xmltype(xml_param) into scratch from dual;
- return 1;
- exception
- when others then
- return 0;
- end;
- /
- SQL> update foo set valid = is_valid_xml(xml) where valid is null;
- 2 rows updated.
- SQL> select id, valid from foo;
- ID | VALID
- ----------
- 1 | 1
- 2 | 0
- create function my_create_xml(p_clob clob) return xmltype is
- l_retval xmltype;
- begin
- select xmltype(p_clob) into l_retval from dual;
- return l_retval;
- exception
- when others then
- if sqlcode != -31011 then raise;
- else return null;
- end if;
- end;
- /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement