Hi,
I have a sample xml file created using Editplus( in windows).
< ?xml version="1.0" encoding="UTF-8" ?> < badges > < row UserId="3714" Name="Teacher" Date="2008-09-15T08:55:03.923"/> < row UserId="994" Name="Teacher" Date="2008-09-15T08:55:03.957"/> < / badges>
My goal here is to get this information into Oracle DB table. As suggested here http://stackoverflow.com/questions/998055?sort=newest#sort-top, I tried to execute the sql commands. But couldn't succeed,
========================= sql query 1 ============================
SQL> SELECT XMLTYPE(bfilename('D', 'tmp.xml'), nls_charset_id('UTF8')) xml_data FROM dual;
XML_DATA
------------------------------------------------------------
<?xml version="1.0" encoding="WINDOWS-1252"?>
<badges>
<row UserId="3714" Name
In the output, I see half of the xml file got truncated. And the encoding type in output is seen as WINDOWS-1252. Could someone explain why is it happening so?
==========================================================================
=============================== sql query 2 ===============================
SQL> SELECT UserId, Name, to_timestamp(dt, 'YYYY-MM-DD"T"HH24:MI:SS.FF3') dt
2 FROM (SELECT XMLTYPE(bfilename('D', 'tmp.xml'),
3 nls_charset_id('WINDOWS-1252')) xml_data
4 FROM dual),
5 XMLTable('for $i in /badges/row
6 return $i'
7 passing xml_data
8 columns UserId NUMBER path '@UserId',
9 Name VARCHAR2(50) path '@Name',
10 dt VARCHAR2(25) path '@Date');
XMLTable('for $i in /badges/row
*
ERROR at line 5:
ORA-00933: SQL command not properly ended
===================================================================== The same query was working here http://stackoverflow.com/questions/998055?sort=newest#sort-top. But for me it doesn't. I have oracle 10g installed on my machine. Could someone suggest the corrections to make the queries work.
Thanks.