C + + Complete Oracle stored procedure BULK INSERT (ii)

Source: Internet
Author: User
Tags bulk insert

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.