Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Associative Arrays - Index Not In Array
absinth wrote:
> Say I have an associative array 'blah' and it has members 'hello' and
> 'bye.'
>
> How can I instruct Oracle to return a NULL if I lookup the array and
> the value isn't found?
>
> E.g.
> blah('hello') might map to '1'
> But I want blah('Oracle') to return NULL.
SQL> declare
2 type tabtype is table of number index by varchar2(10);
3 tab tabtype;
4 x number;
5 begin
6 begin
7 x := tab('Oracle');
8 exception
9 when no_data_found then 10 x := null;
PL/SQL procedure successfully completed. Received on Thu Jun 09 2005 - 04:13:24 CDT
![]() |
![]() |