Displaying Size of image in Oracle Forms

Posted on 2014-01-11
Last Modified: 2014-01-19
i m using get_file_name built-in on when-button-pressed trigger and save image in database BLOB datatype, every thing is going smoothly but i have a requirement that if load size is more then 25 kb then user unable to save this image with
message ('Image Size is more then 25kb ');

i got some online help can any one exaplain me this code


CREATE OR REPLACE PROCEDURE load_file ( p_id NUMBER, p_photo_name IN varchar2)
src_file BFILE;
dst_file BLOB;
lgh_file BINARY_INTEGER;  
src_file := bfilename('PHOTO_DIR', p_photo_name);
  -- insert a NULL record to lock
 INSERT INTO temp_photo  (id, photo_name, photo) VALUES (p_id , p_photo_name ,EMPTY_BLOB())  RETURNING photo INTO dst_file;  
SELECT photo   INTO dst_file  FROM temp_photo  WHERE id = p_id  AND photo_name = p_photo_name  FOR UPDATE;  
dbms_lob.fileopen(src_file, dbms_lob.file_readonly);  
lgh_file := dbms_lob.getlength(src_file);
dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
UPDATE temp_photo   SET photo = dst_file  WHERE id = p_id  AND photo_name = p_photo_name;

END load_file;

The procedure created successfully

execute load_file(1,'Sunset.jpg'); gives me the following error :

ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512: at line 6

Thanks in advance
Question by:hinamansoor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39774135
Look like either you define a database directory named PHOTO_DIR that points to the proper folder pointed to by PHOTO_DIR doesn't contain a file called Sunset.jpg.

The online docs have the information about creating directories and about  dbms_lob.loadfromfile.

Create directory:


As for the code itself, I think there are several unnecessary steps involved.  There are several examples on the the web if you look around.

Personally I would change the procedure call and go with:

Google around for LOADBLOBFROMFILE and you'll  locate many examples.

Accepted Solution

hinamansoor earned 0 total points
ID: 39779527
i have solved this issue by using


Thanks for all

Author Closing Comment

ID: 39791920
i have solved this issue by using


Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Distinct values from all columns in a table?? PL SQL 4 59
run sql script from putty 4 191
format dd/mm/yyyy parameter 16 48
error doing substr 3 37
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question