oraclemergeinto函数中插⼊clob字段
当使⽤Merge into 函数向ORACLE数据库中插⼊或更新数据时,报错“ORA-01461: 仅可以为插⼊ LONG 列的 LONG 值赋值”,使⽤如下⽅法可以把String转换为clob。
需要引⼊ JDBC drivers (ojdbc14.jar or ojdbc5.jar)
merge函数CLOB tempClob = ateTemporary(conn, true, CLOB.DURATION_SESSION);//Open the temporary CLOB in readwrite mode to enable writing
tempClob.open(CLOB.MODE_READWRITE);// Get the output stream to write
Writer tempClobWriter = CharacterOutputStream();// Write the data into the temporary CLOB
tempClobWriter.write(stringData);// Flush andclose the stream
tempClobWriter.flush();
tempClobWriter.close();//Close the temporary CLOB
tempClob.close();
myStatement.der, tempClob);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。