ORA-01461 with MERGE INTO statement and clob column

2.3k views Asked by At

The query:

MERGE INTO app_role_data x USING (select ? name, ? xml FROM dual) d ON (x.app_name = d.name) WHEN MATCHED THEN UPDATE SET x.xml_blob = d.xml WHEN NOT MATCHED THEN INSERT(app_name, xml_blob) VALUES(d.name, d.xml)

The table:

create table app_role_data(app_name varchar2(64), xml_blob clob);

The result: When a row exists, we get ORA-01461.

The desired goal: This is a "create or replace" operation on a row in this table, effectively. If 'name' exists in the table, then the xml column should be updated, else a new row inserted.

1

There are 1 answers

1
nsayer On BEST ANSWER

I think this turns out to be solved by using the Spring JDBC LOB setting functionality documented at 11.7.2 of the Spring Framework documentation.

However, that isn't working either... but will be the subject of another question.