Formula Column [message #498217] |
Wed, 09 March 2011 04:54 |
|
new_oracle2011
Messages: 174 Registered: March 2011 Location: Qatar
|
Senior Member |
|
|
I am having some problem with the code below. It does not give neither give any error during compilation nor give expected results. I have wrote this code behind a formula column which take the image from a server. The name of the image and location is carried out from database. When ever there is new record new name of the image is posted in this formula column. But when the file is not present in the location it gives error. When the error occur i cant able to view the report. The error says 'You cant run the report without layout'. When all images are present in the directory then report runs fine. Kindly help me out so that I can run the report even when there is no image.
function CF_QID_IMAGE return Char is
l_file_exists BOOLEAN;
l_file_len NUMBER;
l_blocksize BINARY_INTEGER;
image_link varchar2(50);
begin
SELECT J.MEANING into image_link
FROM PDADEV.JLS_LOOKUP J
where J.CODE = 'QIM'
and J.ENABLED = '1';
--image_link := image_link||'R'||to_char(Q_1.QIDNO)||'.gif'
--return (image_link||'Q'||to_char(:QIDNO)||'.gif');
--exception when others then return null;
--end;
--BEGIN
utl_file.fgetattr(
location => image_link,
filename => 'Q'||to_char(:QIDNO)||'.GIF',
fexists => l_file_exists,
file_length => l_file_len,
block_size => l_blocksize);
IF l_file_exists THEN
dbms_output.put_line('File found.');
return (image_link||'Q'||to_char(:QIDNO)||'.GIF');
ELSE
dbms_output.put_line('File not found.');
return (image_link||'Q00000000000.GIF');
END IF;
END;
[EDITED by LF: applied [code] tags to preserve formatting]
[Updated on: Wed, 09 March 2011 05:05] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|