| Case Number | 00053952 |
| Oracle Module | Accounts Receivable (AR) |
| EBS Version | R12 |
| Functional Area | Invoice/Transaction Processing / Database Sequence |
| Related Patches | None |
RA_CUSTOMER_TRX_LINES_S has a NEXTVAL that is lower than the current maximum CUSTOMER_TRX_LINE_ID in RA_CUSTOMER_TRX_LINES_ALL.The Oracle sequence RA_CUSTOMER_TRX_LINES_S has drifted out of sync with the data in RA_CUSTOMER_TRX_LINES_ALL. This typically occurs after a database refresh, clone, import, or data migration where existing rows were inserted with IDs higher than the sequence's current position. When Oracle attempts to use the sequence to generate a new primary key, it produces a value that already exists, causing unique constraint violations.
This fix must be performed by a DBA. It is recommended to test in a non-production clone before applying to production, as sequence values may differ between environments.
Execute the following and note the returned value:
SELECT ra_customer_trx_lines_s.NEXTVAL FROM DUAL;
Execute the following and note the returned value:
SELECT MAX(customer_trx_line_id) FROM ra_customer_trx_lines_all;
The sequence NEXTVAL (Step 1) must be greater than the maximum ID (Step 2). Calculate the difference and add a buffer. For example, if NEXTVAL = 20,000 and MAX ID = 16,300, use an increment of at least 4,000.
Alter the sequence to increment by the calculated value:
ALTER SEQUENCE ra_customer_trx_lines_s INCREMENT BY <increment_value>;
Run NEXTVAL exactly once to advance the sequence by the large increment:
SELECT ra_customer_trx_lines_s.NEXTVAL FROM DUAL;
Verify the returned value is now greater than the maximum table ID from Step 2.
ALTER SEQUENCE ra_customer_trx_lines_s INCREMENT BY 1;
Confirm the sequence is properly set:
SELECT * FROM DBA_SEQUENCES WHERE sequence_name = 'RA_CUSTOMER_TRX_LINES_S';
Retry the failing AR transaction creation to confirm the issue is resolved.
| File | Description |
|---|---|
| data_fix.txt | Step-by-step DBA instructions to resync the RA_CUSTOMER_TRX_LINES_S sequence with the maximum customer_trx_line_id in RA_CUSTOMER_TRX_LINES_ALL. Includes statements to check current values, alter sequence increment, advance the sequence, and reset increment to 1. |
| Object | Action |
|---|---|
| RA_CUSTOMER_TRX_LINES_S (sequence) | Increment temporarily; advance NEXTVAL; reset increment to 1 |
| RA_CUSTOMER_TRX_LINES_ALL (reference) | Read only — used to determine MAX(customer_trx_line_id) |