I am not able to display the bmp stored in the BFILE.I followed the following steps.I have been following the
NOTE from metalink and the oracle app dev guide.
 
CREATE TABLE empbfiles (id NUMBER PRIMARY KEY, empname VARCHAR2(20),
                           photo BFILE);
   /
   CREATE OR REPLACE DIRECTORY empbfiles AS '/u02/ora';
/
 
INSERT INTO empbfiles VALUES (1, 'Smith',bfilename('EMPBFILES', 'smith.bmp'));
/
 
select count(*) from empbfiles where id=1;
/

  COUNT(*)
----------
         1
I am using the following procedure(got this from the oracle app devlopers guide) to display the bfile data
 
CREATE OR REPLACE PROCEDURE displayBFILE_proc IS
Lob_loc BFILE;
Buffer RAW(1024);
Amount BINARY_INTEGER := 1024;
Position INTEGER := 1;
BEGIN
/* Select the LOB: */
SELECT photo INTO Lob_loc
FROM empbfiles WHERE id = 1;
/* Opening the BFILE: */
DBMS_LOB.OPEN (Lob_loc, DBMS_LOB.LOB_READONLY);
LOOP
DBMS_LOB.READ (Lob_loc, Amount, Position, Buffer);
/* Display the buffer contents: */
DBMS_OUTPUT.PUT_LINE(utl_raw.cast_to_varchar2(Buffer));
Position := Position + Amount;
END LOOP;
/* Closing the BFILE: */
DBMS_LOB.CLOSE (Lob_loc);
END;
 
when I execute the above procedure I am getting the following error
 
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_LOB", line 656
ORA-06512: at "HHNEWBUILD.DISPLAYBFILE_PROC", line 13
ORA-06512: at line 1
 
What am i missing or doing wrong.
 
Ravi
 
 
 

 

Reply via email to