I'm merging a clob into my oracle database using Groovy. Everything is working fine, except when there is an empty Clob. Instead of making my table column NULL, it's setting it to an empty string.
Clob myClob = CLOB.createTemporary(sql.getConnection(), false, CLOB.DURATION_SESSION);
while ((row = reader.readNext()) != null) {
myClob.truncate(0)
myClob.setString(1,row[17])
def stmt = /
MERGE INTO my_table a
USING (
SELECT ${row[0]} id,
${myClob} clob_column
FROM dual) e
ON (a.id = e.id)
WHEN MATCHED THEN
UPDATE SET
a.clob_column = e.clob_column
/
def runsql = sql.execute(stmt)
}
I've tried passing "NULL" instead of my Clob value and it works, but I can't seem to figure out how to conditionally pass it to my merge statement when the clob is empty. I can't just set "myClob" to null, because then it fails when it loops and tries to truncate it. I was hoping I could do something like an elvis operator in the closure:
${myClob ?: null}
or
${if(myClob.length() > 0) then myClob else null}
but neither seem to work.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
Im developing a Netbeans platform application and Im trying to reuse editor componentI know how to use the Diff component but not the simple editor
Scenario: Search a product in Amazon and then sort by price low to highThe logic that I thought of is- A) go through each page using while page count
Related Java will synchronized block if changed?
I am trying to unit test method that is responsible for returning the number of fat of given product