Apex 20.2
db; 19c
Overall goal:
I always want ensure that at least one user is in the manage organization role. I count the number of users in that role, and if there is more than one, I want to allow a user to be removed from the role, or the user can be deleted. If there is only one user in the manage organization role, I don't want to allow the user in the manage organization role to be deleted, or removed from the role. A message should be generated to explain the situation.
1 error has occurred
Error processing validation
debug shows:
- ora_sqlerrm: ORA-06502: PL/SQL: numeric or value error
P34_MANAGER_COUNT IS A NUMERIC FIELD
error occurs after apply changes button clicked
Is the problem related to validating when clicking the update button and the P34_MANAGE_ORG IS NOT ACTUALLY PART OF THE UPDATE?
I use a dynamic action to count the number of manage_orgs = Y
DECLARE
v_temp number;
BEGIN
SELECT COUNT(PRIMARY_ORG_ROLE_ID)
INTO
v_temp
FROM PRIMARY_ORG_ROLE
WHERE PRIMARY_ORG_ID = :P34_PRIMARY_ORG_ID AND MANAGE_ORG = 'Y';
RETURN v_temp;
END;
Then I validate and check :P34_MANAGE_ORG because the customer needs to have at least one manage org user and won't be allowed to remove a manager unless another user becomes a manager first.
Is there a better way to ensure that a user can't delete a user or remove their manage org permissions if there is not at least one manager?
submit button

Validation: tried 0 to test

