Hi,

I had a question about the exceptions in oracle forms. I had a code which has some exceptions and everything is defined under IF condition.I attached the below snippet of my code which has Exception defined under IF condition but the code some how doesn't go under exception but instead it goes to message('h') which you can see in the code. The problem with the code is after going to message('e') and if pkg_PI_AddIn_Long_Name := xlPIAddInLongName_v9; is not true it should go to exception to start to look under message('e.1') which is not working now instead it directly jumps into message('h'). As i have two versions defined under xlPIAddInLongName_v9 and xlPIAddInLongName_v8 and i am expecting the code should jump to Exception if it cant find right version in xlPIAddInLongName_v9. If any one can help me out to know whats the problem and why its not going into exception that would be great. I really appreciate for the help. See the code below.


--laxmi begin
IF pkg_found THEN

pkg_args := CLIENT_OLE2.Create_Arglist;
CLIENT_OLE2.Add_Arg(pkg_args, xlPIAddInLongName_v9);
message('c:'||xlPIAddInLongName_v9);

BEGIN

message('d');

lo_PIAddIn := Client_Pa_ole.Fn_Get_Obj_Property(lo_AddIns, 'Item', pkg_args);
pkg_PI_AddIn_Long_Name := xlPIAddInLongName_v9;
message('e:'||pkg_PI_AddIn_Long_Name);
CLIENT_OLE2.Destroy_Arglist(pkg_args);

EXCEPTION

WHEN OTHERS THEN
--try the old version
message('e.0');
BEGIN
message('e.1');
--redo the argument list with the old name
CLIENT_OLE2.Destroy_Arglist(pkg_args);
pkg_args := CLIENT_OLE2.Create_Arglist;
message('e.2');
CLIENT_OLE2.Add_Arg(pkg_args, xlPIAddInLongName_v8);
lo_PIAddIn := Client_Pa_ole.Fn_Get_Obj_Property(lo_AddIns, 'Item', pkg_args);
pkg_PI_AddIn_Long_Name := xlPIAddInLongName_v8;
CLIENT_OLE2.Destroy_Arglist(pkg_args);
EXCEPTION
WHEN OTHERS THEN
message('e.3');
--this is bad
Client_Pa_ole.Pr_Release(lo_AddIns);
message('e.4');
RETURN(FALSE); --this will be false if the addin was not loaded
END;
END;
--Uninstall so the install will do something

message('h');
pkg_PI_loaded:= Client_Pa_ole.Fn_Get_Num_Property(lo_PIAddIn, 'Installed');

message('i:'||pkg_PI_loaded);

IF pkg_PI_loaded = Client_Pa_ole.vbTrue THEN
message('j');
Client_Pa_ole.Pr_Set_Property(lo_PIAddIn, 'Installed', Client_Pa_ole.vbFalse);
END IF;
message('k');
Client_Pa_ole.Pr_Set_Property(lo_PIAddIn, 'Installed', Client_Pa_ole.vbTrue);
message('l');
Client_Pa_ole.Pr_Release(lo_PIAddIn);
END IF;

message('m');

Client_Pa_ole.Pr_Release(lo_AddIns);
RETURN(pkg_found); --this will be false if the addin was not loaded
END Fn_Load_PI_AddIn;