I'm trying to insert whole text contents of file.txt into a CLOB column!
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;
}
I want to know is there any way to insert file directly to the data base? ( A function like Read_Whole_File() in the code )
In order to be able to insert a file into a clob first I had to make a procedure in SQLPLUS! SOURCE is my clob file and TEMP_CLOB is a predefined directory.
Next in my code I had to run this procedure:
Using code:
Result:
-Keep this in mind that for making and running procedures you have to login AS SYSDBA.( Change oracleClient.dll to OracleManagedAcess.dll if you're using C or .NET)