Home » Developer & Programmer » Forms » Exception in oracle forms (oracle 10g forms)
Exception in oracle forms [message #420860] Wed, 02 September 2009 12:02 Go to next message
nanipanjakadi
Messages: 6
Registered: September 2009
Location: Canada
Junior Member
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'). 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.


Code:


--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;
Re: Exception in oracle forms [message #420862 is a reply to message #420860] Wed, 02 September 2009 12:10 Go to previous messageGo to next message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Can you please use code tags when posting code - see the orafaq forum guide if you're not sure how.
2) Why do you expect it to go into the exception handler?
If you're expecting to see message e then the only way it's going into the exception is if:
CLIENT_OLE2.Destroy_Arglist(pkg_args);
raises an error.

What error do you expect it to raise?
Re: Exception in oracle forms [message #420863 is a reply to message #420862] Wed, 02 September 2009 12:25 Go to previous messageGo to next message
nanipanjakadi
Messages: 6
Registered: September 2009
Location: Canada
Junior Member
Hi,

Thanks for the quick reply.

I had a third party tool which has two versions old and new. So i stored the name of that tool in xlPIAddInLongName_v9 let say 'X' and xlPIAddInLongName_v8 as 'Y', now the way this works first it goes to IF condition (see the code1 below) and looks under xlPIAddInLongName_v9 if the third party tool has different version which i stored in xlPIAddInLongName_v8(see code2 below) and it should jump to Exception and compile that code which is not working instead if it cant find it is going out of exception.

code 1:

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);

code2:

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;


Hope you understand.
Re: Exception in oracle forms [message #420908 is a reply to message #420860] Thu, 03 September 2009 04:12 Go to previous message
cookiemonster
Messages: 12403
Registered: September 2008
Location: Rainy Manchester
Senior Member
None the wiser really and I asked you to use code tags for a reason - please do so next time.

I still don't understand why you think you'd end up in the exception handler.

So:
1) What line exactly do you expect to throw an error?
2) What error do you expect it to throw?
Previous Topic: WEBUTIL - FORMS - 100501 Non Oracle exception
Next Topic: get_block_property
Goto Forum:
  


Current Time: Fri Dec 02 16:31:21 CST 2016

Total time taken to generate the page: 0.17696 seconds