Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: BFILE
m.bergk_at_stuertz.de (M. Bergk) wrote:
>I am trying to read data from a BFILE column >through the OCI. >OCILobFileOpen() always fails, the error message is >"ORA-00600: Interner Fehlercode, Argumente: [kolferrp_nohdlr], [], [], >[], [], [], [], []" >I have dealt with BLOB columns successfully. >Also, OCILobGetLength() on the BFILE column works.
You failed to mention the platform and Oracle version. Always important pieces in puzzle.
I suggest trying plain PL/SQL first to ensure that the BFILE implementation works - that the directory object is correct, the file permissions okay, and that the DBMS_LOB pacakage work as expected.
Here's a copy and paste of some sample PL/SQL BFILE code I posted earlier this month to this newsgroup:
--Received on Tue Mar 26 2002 - 23:26:04 CST
// you select the BFILE column into the variable fil
// you can get the physical filename for the BFILE variable
dbms_lob.FileGetName( fil, dname, fname );
// you can check if it exists
i := dbms_lob.FileExists( fil ); if i = 0 then raise_application_error( blah blah file does not exist ) end if;
// you can open the file
dbms_lob.FileOpen(fil, dbms_lob.file_readonly);
// you can check the size of the file
i := dbms_lob.getlength(fil);
// you can read the contents of the file into a
// buffer using a start pointer and number of
// bytes to read (ie. just like a BLOCKREAD() call
// in C++, Pascal, whatever)
dbms_lob.read(fil, i, 1, buf);
// you can close the file
dbms_lob.fileclose(fil);
// and you can type cast the raw buffer read into
// a varchar2 - assuming of course you have read
// a text file (just be wary of the max size of
// a varchar2 here)
memo := sys.utl_raw.cast_to_varchar2(buf); -- Billy