Respected Sir,
i am facing a problem. i have folder which contains .jpg pictures of employees. and in reports i am showing their pictures against their IDs. i am using this function formula.
function CF_2Formula return Char is
DIRX VARCHAR2(60) :='D:\Photo\';
PIC VARCHAR2(85);
BEGIN
PIC:=DIRX ||:StuID1||'.JPG';
return pic;
if length(pic) < 28 then
pic:=null;
return pic;
end if;
end;
But in folder if some employee jpg is missing. the report has stop working. and giving this error.
Rep-0108: File 'D:\Photo\132.jpg' not found.
i want this if no picture is found against employee id it will show no_image.jpg picture against missing pictures of the employee.
Please help.
MOS Note 377522.1 talks about this issue. You *must* return a valid path to an image, so here is a workaround:
a) Create an image which is blank, or perhaps contains "No Employee" or something similar. This will be the image used when the one you want is not found.
b) Use TEXT_IO to test for the file in the formula code:
function CF_1Formula return varchar2 is
in_file TEXT_IO.FILE_TYPE;
filename VARCHAR2(30);
begin
filename:= 'd:\photo\'||:nm||'.jpg' ;
in_file := TEXT_IO.FOPEN(filename, 'r');
TEXT_IO.FCLOSE(in_file);
return filename;
EXCEPTION
WHEN NO_DATA_FOUND THEN
TEXT_IO.FCLOSE(in_file);
return 'd:\photo\blank.jpg' ;
WHEN OTHERS then
return 'd:\photo\blank.jpg' ;
end;