- OracleApps Epicenter - http://www.oracleappshub.com -

Where is my Missing Transaction Numbers?

Posted By Sanjit Anand On April 25, 2009 @ 5:14 pm In Oracle Receivable | 1 Comment

Lets revisit some Basic things

  • Invoice Numbers/Transaction Number : These are Numbers generated and controlled by the Source definition. Oracle Reference column is TRX_NUMBER.
  • Document Numbers : This you need to define a Sequence & assign it to the Document Category which is the AR Transaction Type. Oracle Reference column is DOCUMENT_SEQUENCE_VALUE.

dgreybarrow Why Transaction Number sequence is so important

As far as I know, some of European Countries(Italy) and some of APAC(Taiwan, Singapore) Countries have to maintain the Transaction number in sequence. Any Jump in the transaction number may be subject to audit issue with auditors. Therefore its very important to alter the underline seeded sequence definition.

dgreybarrow Why Oracle gives some jump in number

The reason is cache value which comes with seeded sequence .

If you have "caching" enabled on the sequences. This is a feature that is meant to speed up retrieval of heavily used sequences. If the sequence isn't used for a while the cache "ages out" and those numbers that were in the cache get skipped.

Most of Oracle seeded sequence come with Default 20 values.

dgreybarrow Technical note on Oracle Sequence

Based out of Robert Vollman [1] note in his blog. Basically there are 2 potential issues with Oracle sequences

  1. The sequence number may "jump", that is 1,2,3,5,6,8,... with number 4 and 7 missing. One reason is if you do a transaction with NEXTVAL and then rollback, the sequence doesn't roll back to where you started.
  2. By default, the sequence caches the 20 next values for faster retrieval. Thats the reason why most of seeded Oracle sequence have value 20. If there is a system failure, we will lost the cached values upon system recovery. Thus you end up with a gap of up to 20. One way to avoid this is to use NOCACHE command when creating the sequence. And of course you lose the benefit cache brings as well.

dgreybarrow Step to alter the Seeded sequence

1) Query up your invoice source , which user have reported Jump in number.

Navigate>Setup>Invoice>Source

2) Execute the following script using your source as in step 1.

  1.  
  2. SELECT [2] batch_source_id, org_id, name FROM [3] ra_batch_sources_all WHERE [4] name LIKE [5] '<source>';
  3.  

or use this query if you have access from database.

  1.  
  2. SELECT [2] 'alter sequence AR.'||seq.sequence_name||' nocache;' FROM [3]
  3. (SELECT [2]
  4. name bsname, org_id org,
  5. 'RA_TRX_NUMBER_'||BATCH_SOURCE_ID||'_'||org_id||'_S' seqname
  6. FROM [3] RA_batch_sources_all) src,
  7. dba_sequences seq
  8. WHERE [4] src.seqname=seq.sequence_name
  9. AND [6] seq.cache_size;
  10. ORDER [7] BY [8] org
  11. /
  12.  
  13.  

3) Using the batch_source_id from the above query , execute the followingscript:

  1.  
  2. SELECT [2] sequence_owner, sequence_name, cache_size
  3. FROM [3] all_sequences
  4. WHERE [4] sequence_name LIKE [5] 'RA_TRX_NUMBER%1146%';
  5.  
  6.  

4) Execute the following:

  1.  
  2. ALTER [9] sequence SEQUENCE_NAME increment BY [8] 1 nocache;
  3. COMMIT [10];
  4.  
  5.  

Example, if your sequnce is RA_TRX_NUMBER_1146_1166_S

then script would be

  1.  
  2. ALTER [9] sequence RA_TRX_NUMBER_1146_1166_S increment BY [8] 1 nocache;
  3.  

dgreybarrow Few Tips

1.When you create a source and attach a sequence, Oracle will create a sequence like RA_TRX_NUMBER_<batch_id>_<org_id>_S
2. Sequence RA_TRX_NUMBER_<batch_id>_<org_id> _S as is owned by AR.

dgreybarrow How to handle those missing Number

If you have identified in early stage, and missing numbers are very less in count, than create another source with non-automatic number sequence and tell user to use those number which havn't used by Oracle earlier. Once you used all missing number than end date the source.


1 Comment (Open | Close)

1 Comment To "Where is my Missing Transaction Numbers?"

#1 Comment By Durga Reddy On July 18, 2010 @ 11:54 pm

Thanks for ur greate post Sanjit jeeeee


Article printed from OracleApps Epicenter: http://www.oracleappshub.com

URL to article: http://www.oracleappshub.com/accounts-receivable/where-is-my-missing-transaction-numbers/

URLs in this post:

[1] Robert Vollman: http://thinkoracle.blogspot.com/2006/02/oracle-sequences.html

[2] SELECT: http://www.oracle.com/pls/db92/db92.drilldown?word=SELECT

[3] FROM: http://www.oracle.com/pls/db92/db92.drilldown?word=FROM

[4] WHERE: http://www.oracle.com/pls/db92/db92.drilldown?word=WHERE

[5] LIKE: http://www.oracle.com/pls/db92/db92.drilldown?word=LIKE

[6] AND: http://www.oracle.com/pls/db92/db92.drilldown?word=AND

[7] ORDER: http://www.oracle.com/pls/db92/db92.drilldown?word=ORDER

[8] BY: http://www.oracle.com/pls/db92/db92.drilldown?word=BY

[9] ALTER: http://www.oracle.com/pls/db92/db92.drilldown?word=ALTER

[10] COMMIT: http://www.oracle.com/pls/db92/db92.drilldown?word=COMMIT

Disclaimer The opinions expressed here represent solely my own represent personal conjecture based upon experience, practice and observation and does not represent the thoughts, intentions, plans or strategies of my current & previous employers and their clients. Copyright © 2007-2010 OracleApps Epicenter. All rights reserved.