use the Partition Number to generate another variable-driven SQL for the ALTER TABLE ... SWITCH

It strikes me that all the required sub-functions, parameters etc are already there to allow adding this function into the code. This would mean one last call to your module could take care of that and save a bit of package complexity.