First, note that most databases store CLOB data differently based on the amount of data to be stored. A small amount of text may be stored as a VARCHAR when it is under a certain size. See your database vendor documentation for details as this varies from one vendor to another.
You can load the CLOB data in QIE using JDBC. Below is an example:
Create a Published Function with this code:
function loadClobFromQuery(connectionName, queryString, idPredicateValue) {
var connection = qie.getDbConnection(connectionName);
var preparedStatement;
var queryResultSet;
var myClob;
var clobAsString;
try {
preparedStatement = connection.prepareStatement(queryString);
preparedStatement.setInt(1, idPredicateValue);
queryResultSet = preparedStatement.executeQuery();
if (queryResultSet.next()) {
myClob = queryResultSet.getClob(1);
qie.debug("Length of retrieved Clob: " + myClob.length());
}
clobAsString = myClob.getSubString(1, (0 + myClob.length()));
} catch(e) {
qie.debug(e);
} finally {
//finally - close resources
if (myClob !== null) {
myClob.free(); //free the clob to release memory to avoid out of memory errors
}
try{
if (queryResultSet !== null) {
queryResultSet.close();
}
} catch (e) {
qie.debug(e);
}
try{
if (preparedStatement !== null) {
preparedStatement.close();
}
} catch (e) {
qie.debug(e);
}
try{
if (connection !== null) {
connection.close();
}
} catch (e) {
qie.debug(e);
}
}
return clobAsString;
}
Then call it like this:
//Exclude the clob field in this query. We will grab it below.
var queryResult = qie.doQuery("books", "select id, subject from books");
//Only grabbing the clob from the first row of the results since you probably know how to iterate the results already
var result = loadClobFromQuery("books",
"select text from books where id = ? limit 1",
queryResult.getNode('id'));
qie.debug('id: ' + queryResult.getNode('id'));
qie.debug('subject: ' + queryResult.getNode('subject'));
qie.debug('text: ' + result);