Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help me to solve this problem

882106Jan 3 2012 — edited Jan 4 2012
I am a software developer in Pawning project.

Here I developed the system to generate the Pawning Receipt No for each new pawning transaction. Also it prints on Pawning Receipt.
This system is designed to service nearly 100 clients concurrently.


No format is like this:-

this is serialno :- AA00025

AM/NEW/PA/AA00025
AM/NEW/PA/AA00026
AM/NEW/PA/AA00027
...........................28
...........................29

Here I can't use sequences due to the reason of serialno should be generated on Branch and Scheme basis. For example :-


AM/NEW/PA/AA00025 :- this is receipt no gerated by 'AM' branch

AV/NEW/PA/AA00025 :- receipt no gerated by 'AV' branch (which are two diffident receipt nos generated in two branches.)

Currently I am using this method

I have a table called "Serialno_Tab" which contains "Branch","Scheme","Last Serialno"
Then what i do is, in stored procedure I read the last serialno for the given branch & scheme from the above table and update the "Last Serialno" incrementing by 1

here i useed "for update" statement with select query to avoid duplicates. When increasing the no of users working concurrently it caused to hang the database from not released table locks.

So, I think this is not best solution for generating nos

So, What is the best approach to generate a unique Pawning Receipt Nos for this requirement?

Thx a lot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2012
Added on Jan 3 2012
18 comments
415 views