0
votes

I've got a error with my Oracle Web App. When I type the URL "http://mydomain.com/pls/docs" in my browser, I get this error:

Estado de Descarga

Descarga del archivo falló. ORA-01403: no data found. ORA-01403: no data found

And the code that generates this error is:

PROCEDURE LEP_DESCARGA_ARCHIVO IS

      lv_FilePath VARCHAR2(32000);
      lv_FileName VARCHAR2(32000);
  BEGIN

lv_FilePath := SUBSTR(owa_util.get_cgi_env('PATH_INFO'),2);


     SELECT name INTO lv_FileName
     FROM table_file
     WHERE UPPER(name) like UPPER(lv_FilePath);
     wpg_docload.download_file(lv_FileName);

EXCEPTION

  WHEN OTHERS THEN

    HTP.htmlopen;
    HTP.headopen;
    HTP.title('Archivo Descargado');
    HTP.headclose;
    HTP.bodyopen;
    HTP.header(1, 'Estado de Descarga');
    HTP.print('Descarga del archivo ' || lv_filePath || ' falló.');
    HTP.print(SQLERRM);
    HTP.bodyclose;
    HTP.htmlclose;
END LEP_DESCARGA_ARCHIVO;

The problem is that Error shows too much information in the Error. LEP_DESCARGA_ARCHIVO is important for another process in my site.

Where do I have to configure Oracle in order for this Error not to appear? I mean I do not want to get this Error if I type the URL:

https://mydomain.com/pls/docs/servlets/index.html
**Error:** Descarga del archivo servlets/index.html falló. ORA-01403: no data found

h t t p s : / / m y d o m a i n . c o m / p l s / d o c s /
**Error:** Descarga del archivo falló. ORA-01403: no data found                        

h t t p s : / / m y d o m a i n . c o m / p l s /d o c s / s e r v l e t s/
**Error:** Descarga del archivo servlets/ falló. ORA-01403: no data found 
1

1 Answers

0
votes

You're displaying this error for two reasons.

Firstly, this query returns no data:

SELECT name INTO lv_FileName
  FROM table_file
 WHERE UPPER(name) like UPPER(lv_FilePath);

This is why the exception is raised. There is no name in the table TABLE_FILE that matches your variable lv_filename. Whether you want to fix this error is up to you.

The second reason the error is displayed is because of this line:

HTP.print(SQLERRM);

You're outputting it. If you don't want to output the error, you don't have to.

It might be more normal to catch this error explicitly and do something with it, if you want to.

begin
   ...
   select name into ...
   ...

exception 
   when no_data_found then
      -- do something
   when others then
      -- do something else
end;