I have to store a file (pdf or txt or …) in a cblob field of an oracle db.
How i have to build the sql-statement?
First try:
Code:
SqlQueryStatement $sqlQueryStatement := new SqlQueryStatement;
Indexed Any $values := new Indexed Any;
String $data := ReadBinaryData('work\\tmp\\uploads' & $file);
$sqlQueryStatement .sqlStatement := 'INSERT INTO DOCUMENTS(id, doc) values(12345, utl_raw.cast_to_raw(?))';
$values.addElement($data);
$sqlQueryStatement.paramsForStatement := $values;
SqlQuery(GetDefaultDatasource(true), $sqlQueryStatement.sqlStatement.toString(), $sqlQueryStatement.paramsForStatement);
Result:
can bind a LONG value only for insert into a LONG column
Second try :
If if use READTEXTFILE() instead ReadBinaryData() and a txt-file, it works correct (only) for txt.
I have to store a file (pdf or txt or …) in a cblob field of an oracle db.
How i have to build the sql-statement?
First try:
Code:
SqlQueryStatement $sqlQueryStatement := new SqlQueryStatement;
Indexed Any $values := new Indexed Any;
String $data := ReadBinaryData('work\\tmp\\uploads' & $file);
$sqlQueryStatement .sqlStatement := 'INSERT INTO DOCUMENTS(id, doc) values(12345, utl_raw.cast_to_raw(?))';
$values.addElement($data);
$sqlQueryStatement.paramsForStatement := $values;
SqlQuery(GetDefaultDatasource(true), $sqlQueryStatement.sqlStatement.toString(), $sqlQueryStatement.paramsForStatement);
Result:
can bind a LONG value only for insert into a LONG column
Second try :
If if use READTEXTFILE() instead ReadBinaryData() and a txt-file, it works correct (only) for txt.
Can someone please give me a hint ?
Ingo