The previous article briefly describes the Oracle parameters database stored procedure of type object, and how Java uses JDBC to invoke stored procedures of that class.
But what I need is a solution under C + +. Using POCO libraries did not find any way to invoke the type of stored procedures, but the functionality still needs to be implemented, and later found that Oracle supports XML parsing, so the following scenarios. That is, the stored procedure has the CLOB type, and C + + invokes the stored procedure in the form of an incoming XML format string, after parsing the XML in the stored procedure. Insert the data into the database.
(with the above scenario, I suspect that JDBC might also be handled in an XML-formatted string to the Oracle database, and that Oracle can implement the XML-to-object conversion and finally pass the object argument 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 project code.
C + + Complete Oracle stored procedure BULK INSERT (ii)