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
  • 2
LVL 76

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle - SQL Script to test for bill dates 3 or more times in SAME WEEK? 11 45
PL/SQL - Leading zeros 7 59
Read only access to a Procedure in oracle? 4 48
Oracle SQL 6 48
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now