The previous article briefly describes the Oracle parameter is a database stored procedure of type Object and Java uses JDBC to invoke the method of the class's stored procedure. But what I need is a scenario under C + + that uses Poco libraries to find no way to invoke that type of stored procedure, but the functionality still needs to be implemented, and later it is found that Oracle supports XML parsing, so the following scenario, the parameters of the stored procedure is the CLOB type, C + + The stored procedure is called in the form of an incoming XML format string, and the data is inserted into the database after parsing the XML in the stored procedure.
(with the above scenario, I suspect that JDBC might also be handled in an XML-formatted string to the Oracle database, and Oracle can implement the XML-to-object conversion, and finally pass the object parameter to the stored procedure)
The following is the main code for the scenario:
1) Oracle Stored Procedures
Create or Replace procedure Poco_test_xml_clob_pro (V_xml in CLOB) isbegin INSERT into Poco_test (Id,name,code) SELECT * from XMLTABLE (' $B/parment/pocotest ' passing XMLTYPE (v_xml) as B COLUMNS ID VARCHAR2 () PATH '/ Pocotest/id ', NAME VARCHAR2 (() path '/pocotest/name ', CODE VARCHAR2 (path '/pocotest/code '); End Poco_test_xml_clob_pro;
2) calls to C + + code
std::string str;odbcobject::getcollectionxmlstr (Str,arr); Poco::D ata::clob CLOB (Str.c_str (), Str.size ()), session << "{call Poco_test_xml_clob_pro (?)}", Poco::D ata:: Keywords::in (CLOB), Poco::D ata::keywords::now;
This is the complete engineering code.
C + + Complete Oracle stored procedure BULK INSERT (ii)