Search code examples
c++databaseoracle-databaseclobsoci

SOCI clob data type in oracle c++


can someone say how to handle CLOB datatype in SOCI C++?

I want to know how to read CLOB data column values in oracle using C++ SOCI.

I tried to use BLOB type in SOCI but It gives an error. Oracle error 932: inconsistent datatypes expected %s got %s ERROR


Solution

  • I have used following with google test and it works for me,

    // insert clob
    std::string str = "string as clob";
    dbSession << "INSERT INTO CLOB_TABLE (ID, DATA) VALUES(:a, :b)",soci::use(1, "a"), soci::use(str, "b");    
    
    // read clob
    dbSession << "SELECT DATA FROM CLOB_TABLE WHERE ID = 1", soci::into(str);