raise no_data_found
Marcio, January 03, 2005 - 7:48 am UTC
It must be a silly question, but anyway.
Regarding your code below
<quote>
11 begin
12 dbms_lob.FILEGETNAME( p_bfile, l_dir, l_fname );
13 return g_array(l_dir) || '\' || l_fname;
14 exception
15 when no_data_found
16 then
17 select directory_path
18 into l_path
19 from all_directories
20 where directory_name = l_dir;
21
22 g_array(l_dir) := rtrim(l_path,'\');
23 return g_array(l_dir) || '\' || l_fname;
24 end;
</quote>
What statement is raising NO_DATA_FOUND ?
Thanks and regards,
January 03, 2005 - 9:09 am UTC
g_array(l_dir)
does, when g_array(l_dir) has "no data" in it. accessing a plsql index by table raises no data found.
NO_DATA_FOUND
Marcio, January 03, 2005 - 11:45 am UTC
Interesting, because when I put
exception
when others ...
it didn't raise anything as well as without exception clause.
I thought that every exception must give us a raise.
Is there either some parameter to force the exception be raised in this case?
Thanks,
January 03, 2005 - 10:21 pm UTC
not sure what you are trying to say?
when others is evil. unless followed by RAISE -- 99.9999999999999999% of the time.
Please ignore my last NO_DATA_FOUND review
Marcio, January 03, 2005 - 1:14 pm UTC
Sorry Tom, it is documentted.
I aggregated a little procedure p which raise a no_data_found.
25 procedure p
26 is
27 l_dir varchar2(4000);
28 l_fname varchar2(4000);
29 l_path varchar2(4000);
30 begin
31 for x in ( select * from test )
32 loop
33 dbms_lob.FILEGETNAME( x.image, l_dir, l_fname );
34 dbms_output.put_line( 'The value of garray is '|| g_array(l_dir) );
35 end loop;
36 end;
37
38 end;
39 /
Package body created.
ops$mportes@FCCUAT9I> show error
No errors.
ops$mportes@FCCUAT9I>
ops$mportes@FCCUAT9I> exec bfile_pkg.p
BEGIN bfile_pkg.p; END;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "OPS$MPORTES.BFILE_PKG", line 34
ORA-06512: at line 1
Thanks and rgds,