Home > database >  Oracle to parse the XML string
Oracle to parse the XML string

Time:02-24

Only familiar with essentially,
Need to v_EventDataXml string parsing, and save to the temporary table,
After batch execution, tip: lack INTO clause in the SELECT statement

where I went wrong???

 
The create global temporary table TPECOVID19Info
(
PhysicalRegisterId number (10, 0),
SourceCodeId number (10, 0),
IdentityCodeId number (10, 0),
IsFromForeignin14 number (10, 0),
CreateEmployeeId number (10, 0),
CreateTime TIMESTAMP (6)
) on the commit preserve rows;
- drop table TPECOVID19Info;
DECLARE
V_EventDataXml clob.
V_Xml xmltype;
V_PhysicalRegisterId number (10, 0);
V_SourceCodeId number (10, 0);
V_IdentityCodeId number (10, 0);
V_IsFromForeignin14 number (10, 0);
V_CreateEmployeeId number (10, 0);
CreateTime TIMESTAMP (6);
The BEGIN
V_EventDataXml:='& lt; PECOVID19Info XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance" XMLNS: XSD="http://www.w3.org/2001/XMLSchema" & gt;
21034 & lt;/PhysicalRegisterId> 2 & lt;/SourceCodeId> 1 & lt;/IdentityCodeId> 9062 & lt;/CreateEmployeeId> The 2021-02-23 T16:34:57. 9812563 + 08:00 & lt;/CreateTime> V_Xml:=xmltype (v_EventDataXml);

- insert into TPECOVID19Info (v_PhysicalRegisterId v_SourceCodeId, v_IdentityCodeId, v_IsFromForeignin14, v_CreateEmployeeId)
The select PhysicalRegisterId SourceCodeId, IdentityCodeId IsFromForeignin14, CreateEmployeeId
Into v_PhysicalRegisterId v_SourceCodeId, v_IdentityCodeId v_IsFromForeignin14, v_CreateEmployeeId
The from the xmltable (' PECOVID19Info '
Passing v_Xml
The columns PhysicalRegisterId number (10, 0) path 'PhysicalRegisterId,
Path 'SourceCodeId SourceCodeId number (10, 0),
Path 'IdentityCodeId IdentityCodeId number (10, 0),
Path 'IsFromForeignin14 IsFromForeignin14 number (10, 0),
CreateEmployeeId number (10, 0) path 'CreateEmployeeId'
) t;
-- dbms_output. Put_line (v_EventDataXml);
Select * from TPECOVID19Info;
The EXCEPTION
The WHEN OTHERS THEN
Dbms_output. Put_line (' execution went wrong, the boss! ');
END;

  • Related