将文本文件的内容插入 Oracle CLOB

Insert contents of a text file into the Oracle CLOB

我正在尝试将 file.txt 的整个文本内容插入到 CLOB 列中!

Connection^ DB = gcnew Connection();
OracleConnection^ Ocnn=DB->getOracleConnectionObject();
int number = 0;

try {
    // here >>
    OracleCommand^ c = gcnew OracleCommand("INSERT INTO PANDA.PAGE(SITE_ID, URL, SOURCE) VALUES('40', 'www.site.com', Read_Whole_File('C://Users/farmehr/Desktop/', 'file.txt'))", Ocnn);
    number = c->ExecuteNonQuery();

}
catch (Exception^ eOra) {
    Console::WriteLine(eOra->Message + "Exception Caught");
    throw eOra;
}

我想知道有什么方法可以直接插入文件到数据库中吗? (代码中类似 Read_Whole_File() 的函数)

为了能够首先将文件插入到 clob 中,我必须在 SQLPLUS 中创建一个过程! SOURCE 是我的 clob 文件,TEMP_CLOB 是预定义的目录。

接下来在我的代码中我必须 运行 这个过程:

使用代码:

结果:

-请记住,对于制作和 运行ning 程序,您必须以 SYSDBA 身份登录。(如果您使用的是 C 或 .NET,请将 oracleClient.dll 更改为 OracleManagedAcess.dll )