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

Source: Internet
Author: User
Tags bulk insert

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)

Related Article

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.