Home » SQL & PL/SQL » SQL & PL/SQL » Converting BFILE to BLOB
Converting BFILE to BLOB [message #44646] Sun, 28 December 2003 01:24 Go to next message
Sreenivas
Messages: 15
Registered: January 2000
Junior Member
Dear All,

I need to print the logo ( image) in my crystal report.
This should be parameterized.

For that I think I need to store it in database as BLOB.
I wrote the following code to convert the BFILE to BLOB and updated in the BLOB field of the table.
( of course I have hard coded some of the things. )



create directory fly_away as 'C:GEBEXE' ;
insert into image1 values( 2, EMPTY_CLOB(),EMPTY_BLOB(),BFILENAME('FLY_AWAY','fly_away.jpg')) ;


CREATE OR REPLACE PROCEDURE CONVERT_TO_BLOB IS
l_lobd BLOB;
l_fl_bfile BFILE := BFILENAME('FLY_AWAY','fly_away.jpg');
-- l_nm_amt INTEGER := 4000;
BEGIN
SELECT blob_col INTO l_lobd FROM image1 WHERE key = 2 FOR UPDATE;
dbms_lob.fileopen(l_fl_bfile, dbms_lob.file_readonly);
DBMS_OUTPUT.PUT_LINE('First ') ;
dbms_lob.loadfromfile(l_lobd, l_fl_bfile,DBMS_LOB.GETLENGTH(l_fl_bfile));
DBMS_OUTPUT.PUT_LINE(' Second') ;
UPDATE image1
SET blob_col = l_lobd
WHERE key = 2 ;
DBMS_OUTPUT.PUT_LINE(' Status:'||sqlcode) ;
COMMIT;
dbms_lob.fileclose(l_fl_bfile);
DBMS_OUTPUT.PUT_LINE(' Third') ;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error is :'|| sqlerrm) ;
dbms_lob.fileclose(l_fl_bfile);
END;
/

The procedure executes without any error and comes out with success status.

But when I access the BLOB field from the crystal report.
it gives the following error message
"Failed to open a row set"
" Source: Provider "
" Description : Unspecified error "
" Native error "

I couldn't get whether the conversion is incorrect or the fetching in crystal report is incorrect
Please help me reg the above problem.



Yours anticipatedly,
Sreenivas
Re: Converting BFILE to BLOB [message #44647 is a reply to message #44646] Sun, 28 December 2003 20:39 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
With dbms_lob.getlength() you can verify the length of the BLOB column to see whether there's actually anything in it. To display it, I'd suggest to create a simple Oracle Form (If you have Developer at your hands of course).

But the error, 'failed to open a row set', isn't that an indication that you made some kind of error in the SQL you're trying to pass to Oracle?

MHE
Re: Converting BFILE to BLOB [message #45529 is a reply to message #44646] Mon, 22 March 2004 02:42 Go to previous messageGo to next message
Manas
Messages: 5
Registered: March 2002
Junior Member
Dear Sreenivas,

I am getting similar type of error.....
"Failed to open a row set"
" Source: ADODB.Properties "
" Description : item cannot be found in the collection corresponding to the requested name or ordinal "
" Native error: -2146825023 "
Can you help me in this regard
Manas
Re: Converting BFILE to BLOB [message #45941 is a reply to message #44647] Tue, 27 April 2004 23:49 Go to previous message
adnan
Messages: 15
Registered: May 2001
Junior Member
Re: Converting BFILE to BLOB
Previous Topic: URGENT! -- Oracle forms connectivity to MS SQL Server
Next Topic: Query to find two top salary person from table emp
Goto Forum:
  


Current Time: Mon Aug 25 10:41:57 CDT 2025