'Using Oracle VPD is it possible for a user to hit a view or procedure to get a MAX across the entire table?

I currently have VPD setup on customer ID in my database. We are now allowing customers to add new services to their accounts themselves but the only issue is we need the new service IDs to be unique database wide.

Example is there is currently 2 customers, customer ID's of 1 and 2. Customer 1 has 3 services (service 1,2,3) and Customer 2 has 2 services (4,5).

If customer 1 goes to add a new service today it will give them a service ID of 4 since the MAX logic can only see a max of 3 versus 5.

Is there any way around this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source