I have opened one Structure in Catia, How to query VPMInstance Revision in DB and replace it with required revision of instance in Structure using EKL?

I want to create function which will update the structure in CATIA as per user requirement. User requirement will be FROZEN&ABOVE, Latest Released, Latest Frozen etc.