Home » SQL & PL/SQL » SQL & PL/SQL » Array Need to catch if out of range (Oracle 10g)
Array Need to catch if out of range [message #293001] Thu, 10 January 2008 09:15 Go to next message
jamesn2007
Messages: 5
Registered: January 2008
Location: Duluth
Junior Member
Hi, I'm trying to catch if an array is out of range and not sure how to do this. Here's the example:

The following array exists:
mol(A) = 1
mol(B) = 2
mol(C) = 3

The program tries to find a value for mol(D). When I look at the results its empty. So I've tried "if mol(D) IS Null" and that didn't work. How do you handle this?

Thanks
icon7.gif  Re: Array Need to catch if out of range [message #293002 is a reply to message #293001] Thu, 10 January 2008 09:24 Go to previous message
jamesn2007
Messages: 5
Registered: January 2008
Location: Duluth
Junior Member
Figured it out. I was calling the array in a loop and didn't know if I should use exception handling. I've decided to use it and have tested on a bunch of scenerios and it works fine:

return MolWeight;
Exception
when no_data_found then MolWeight := -1;
return MolWeight;
END;
Previous Topic: HTTP-400 Bad name in the request: not a legal PLSQL identifer
Next Topic: customer data retrieval
Goto Forum:
  


Current Time: Sun Dec 11 08:28:46 CST 2016

Total time taken to generate the page: 0.04761 seconds