Who’s NO_DATA_FOUND is it anyway SQL

 


create table query_returning_no_rows ( i_can_raise_no_data_found integer );

create directory when_reading_data as '/home/oracle'; -- update to a suitable location on your system
-- and create an empty file there called "from_files"

set serveroutput on
declare
empty_variables integer;
i_can_also_raise_ndf utl_file.file_type := utl_file.fopen('WHEN_READING_DATA', 'from_files', 'r');
when_reading_past_the_file_end varchar2(100);
type asso_array is table of integer index by varchar2(100);
when_my_array_accesses asso_array;
i_can_raise_ndf_too integer;
begin
select i_can_raise_no_data_found
into empty_variables
from query_returning_no_rows;

utl_file.get_line(i_can_also_raise_ndf, when_reading_past_the_file_end);

i_can_raise_ndf_too := when_my_array_accesses('non-existent elements');

exception
when NO_DATA_FOUND then
dbms_output.put_line('Welcome to debugging hell');
end;
/

declare
empty_variables integer;
begin

select i_can_raise_no_data_found
into empty_variables
from query_returning_no_rows;

end;
/

declare
i_can_also_raise_ndf utl_file.file_type := utl_file.fopen('WHEN_READING_DATA', 'from_files', 'r');
when_reading_past_the_file_end varchar2(100);
begin

utl_file.get_line(i_can_also_raise_ndf, when_reading_past_the_file_end);

end;
/

declare
type asso_array is table of integer index by varchar2(100);
when_my_array_accesses asso_array;
i_can_raise_ndf_too integer;
begin

i_can_raise_ndf_too := when_my_array_accesses('non-existent elements');

end;
/

drop table query_returning_no_rows purge;
drop directory when_reading_data;

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)