Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Displaying Size of image in Oracle Forms

Posted on 2014-01-11
3
Medium Priority
?
618 Views
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 TABLE TEMP_PHOTO ( ID NUMBER(3) NOT NULL, PHOTO_NAME VARCHAR2(50), PHOTO BLOB );

CREATE OR REPLACE PROCEDURE load_file ( p_id NUMBER, p_photo_name IN varchar2)
IS  
src_file BFILE;
dst_file BLOB;
lgh_file BINARY_INTEGER;  
BEGIN  
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;

 dbms_lob.fileclose(src_file);  
END load_file;

The procedure created successfully

Now,
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
0
Comment
Question by:hinamansoor
[X]
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
3 Comments
 
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:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_5007.htm#SQLRF01207

dbms_lob.loadfromfile:
http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_lob.htm#ARPLS66733

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:
dbms_lob.LOADBLOBFROMFILE

http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_lob.htm#ARPLS66723

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

Accepted Solution

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

"Win_API_File.File_Size"


Thanks for all
0
 

Author Closing Comment

by:hinamansoor
ID: 39791920
i have solved this issue by using

Win_API_File.File_Size
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

610 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