• The numbers given to invoices entered by the users must be unique and also with not gaps . That means that sequences cannot be used since if a transaction rollbacks the number cannot be used by another user. What I actually want to achieve is when a user gets the next available number from the invoice types table (inside the transaction of a new invoice) , to ensure that no other user gets the same number until the transaction is commited. If the transaction is rolledback the number will be available for use by the next user.

    I just want to lock one row from the invoice type during the course of a transaction (so that no other user gets the same number specified in this row)  or any other way to achieve the same result.
    Thank you