Monday, February 13, 2017

Unique Constraint Violated on FND_LOBS

User has declared that while using EBS import in specific form , below error occured,

oracle.apps.fnd.framework.OAException: oracle.jbo.DMLConstraintException: JBO-26048: Constraint "SYS_C00155937" violated during post operation:"Insert" using SQL Statement  "INSERT INTO FND_LOBS(FILE_ID,FILE_NAME,FILE_CONTENT_TYPE, UPLOAD_DATE,PROGRAM_NAME,FILE_DATA,ORACLE_CHARSET,FILE_FORMAT) VALUES (:1,:2,:3,:4,:5,:6,:7,:8)".

This is ORA-00001 error and unique constraint has been violated. FND_LOBS table has unique constraint on FILE_ID column and it take its own value from FND_LOBS_S sequence.

It seems new taken file_id values are already in table.Because of this situation related program throws ORA-00001 error.To solve this issue sequence next value is taken over maximum file_id value in table.

1. Get max value

select max(file_id) from fnd_lobs;

2. Alter sequence's increment value,

alter sequence APPLSYS.FND_LOBS_S increment by 100;

3. Call sequence nextval function to change sequence current value until it will be greater than max(file_id)

select  APPLSYS.FND_LOBS_S.nextval from dual;

4. Run following queries to verify sequence value(last_number) is greater than max(file_id)

select last_number from dba_sequencies where sequence_name='FND_LOBS_S'
select max(file_id) from fnd_lobs;

5. Alter sequence increment by value back to 1

alter sequence APPLSYS.FND_LOBS_S increment by 1;