BFILE로 저장된 데이타 정보를 확인하는 방법

제품 : ORACLE SERVER
작성날짜 : 2002-04-12
BFILE로 저장된 데이타 정보를 확인하는 방법
==========================================
Purpose
Bfile 로 저장된 column의 경우 database 내에서는 file path만 알 수 있다.
여러가지 package를 사용하여 이 bfile로 저장된 data의 정보를 확인하는
방법을 알아보자.
Example
$ vi bfiletest.sql
rem BFILE Example
set echo on
set serveroutput on;
drop directory some_dir_alias;
create directory some_dir_alias as '/mnt3/rctest80/server/ejlee/bfile';
drop table bfiletest;
create table bfiletest (
doc_id number,
doc_file bfile
insert into bfiletest values (1,bfilename('SOME_DIR_ALIAS','docu1.txt'));
declare
i_doc_file BFILE;
i_file_size NUMBER;
i_doc_file_dir VARCHAR2(30);
i_doc_file_name VARCHAR2(2000);
buffer varchar2(100);
amount binary_integer:=5;
offset NUMBER := 2;
begin
select doc_file into i_doc_file from bfiletest where doc_id=1;
if i_doc_file is not null then
if dbms_lob.fileisopen(i_doc_file) = 1 then
dbms_output.put_line('file is open so we are closing file');
dbms_lob.fileclose(i_doc_file);
end if;
dbms_lob.filegetname(i_doc_file,i_doc_file_dir,i_doc_file_name);
dbms_output.put_line('DIRECTORY: ' || i_doc_file_dir);
dbms_output.put_line('Name : ' || i_doc_file_name);
i_doc_file:=BFILENAME(i_doc_file_dir,i_doc_file_name);
dbms_lob.fileopen(i_doc_file,DBMS_LOB.FILE_READONLY);
dbms_lob.read(i_doc_file, amount, offset, buffer);
dbms_output.put_line('Buffer is :'||utl_raw.cast_to_varchar2(buffer));
i_file_size:=DBMS_LOB.GETLENGTH(i_doc_file);
dbms_output.put_line('Length is '||i_file_size);
end if;
end;
실행 결과
SQL> @bfiletest
SQL> set echo on
SQL> set serveroutput on;
SQL> drop directory some_dir_alias;
Directory dropped.
SQL> create directory some_dir_alias as '/mnt3/rctest80/server/ejlee/bfile';
Directory created.
SQL>
SQL> drop table bfiletest;
Table dropped.
SQL> create table bfiletest (
2 doc_id number,
3 doc_file bfile
4 );
Table created.
SQL> insert into bfiletest values (1,bfilename('SOME_DIR_ALIAS','docu1.txt'));
1 row created.
SQL> commit;
SQL> declare
2 i_doc_file BFILE;
3 i_file_size NUMBER;
4 i_doc_file_dir VARCHAR2(30);
5 i_doc_file_name VARCHAR2(2000);
6 buffer varchar2(100);
7 amount binary_integer:=5;
8 offset NUMBER := 2;
9 begin
10 select doc_file into i_doc_file from bfiletest where doc_id=1;
11 if i_doc_file is not null then
12 if dbms_lob.fileisopen(i_doc_file) = 1 then
13 dbms_output.put_line('file is open so we are closing file');
14 dbms_lob.fileclose(i_doc_file);
15 end if;
16 dbms_lob.filegetname(i_doc_file,i_doc_file_dir,i_doc_file_name);
17 dbms_output.put_line('DIRECTORY: ' || i_doc_file_dir);
18 dbms_output.put_line('Name : ' || i_doc_file_name);
19 i_doc_file:=BFILENAME(i_doc_file_dir,i_doc_file_name);
20 dbms_lob.fileopen(i_doc_file,DBMS_LOB.FILE_READONLY);
21 dbms_lob.read(i_doc_file, amount, offset, buffer);
22 dbms_output.put_line('Buffer is :'||utl_raw.cast_to_varchar2(buffer));
23 i_file_size:=DBMS_LOB.GETLENGTH(i_doc_file);
24 dbms_output.put_line('Length is '||i_file_size);
25 end if;
26 end;
27 /
DIRECTORY: SOME_DIR_ALIAS
Name : docu1.txt
Buffer is :his i
Length is 15
PL/SQL procedure successfully completed.

Similar Messages

  • Error in creating index on text BFILE

    Hi,
    I have put data into a table using SQL* Loader. The BFILE exist (I've tested it with a procedure). I've no errors during text indexing but when a look into the view ctx_user_index_errors, I have the following :
    DRG-11101: failed to open file \drgit3
    So, my index doesn't work.
    Any ideas ?

    ORACLE_HOME must be set. Otherwise ctxhx.exe used during indexing won4t work.
    null

  • Error in loading a picture in BFILE

    Hi People,
    This is a procedure to load a .JPEG file in a column with bfile datatype.
    I have created a table ER with following structure:
    CREATE TABLE ER (ENO NUMBER, ENAME VARCHAR2(20), PHOTO BFILE);
    now i have inserted values in this table as,
    INSERT INTO ER(ENO,ENAME) VALUES(10,'VID');
    now i have written a procedure to update the column of photo in er table.
    CREATE DIRECTORY BF AS 'D:/';
    CREATE OR REPLACE PROCEDURE load_bfile
    (p_file_loc IN VARCHAR2) IS
    v_file BFILE;
    v_filename VARCHAR2(16);
    BEGIN
    v_filename := 'SAMPLE' || '.JPEG';
    v_file := BFILENAME(p_file_loc, v_filename);
    DBMS_LOB.FILEOPEN(v_file);
    UPDATE eR SET PHOTO = v_file
    where eno=10;
    DBMS_OUTPUT.PUT_LINE('LOADED FILE: '||v_filename
    || ' SIZE: ' || DBMS_LOB.GETLENGTH(v_file));
    DBMS_LOB.FILECLOSE(v_file);
    END load_bfile;
    The sample picture is now located in D: only.so inorder to execute the procedure i have issued as,
    EXEC load_bfile('BF');
    but following errors occured.
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    The system cannot find the file specified.
    ORA-06512: at "SYS.DBMS_LOB", line 504
    ORA-06512: at "SYS.LOAD_BFILE", line 8
    ORA-06512: at line 1
    what could be the error here.I have checked that all pathname is correct.please suggest me.

    This is the struct of the table ER.
    SQL> DESC ER
    Name Null? Type
    ENO NUMBER
    ENAME VARCHAR2(20)
    PHOTO BINARY FILE LOB
    INSERT INTO ER(ENO,ENAME) VALUES(10,'VID');
    COMMIT;
    The file is in local D drive.
    CREATE DIRECTORY BF AS 'D:/';
    CREATE OR REPLACE PROCEDURE load_bfile
    (p_file_loc IN VARCHAR2) IS
    v_file BFILE;
    v_filename VARCHAR2(16);
    BEGIN
    v_filename := 'SAMPLE' || '.JPEG';
    v_file := BFILENAME(p_file_loc, v_filename);
    DBMS_LOB.FILEOPEN(v_file);
    UPDATE eR SET PHOTO = v_file
    where eno=10;
    DBMS_OUTPUT.PUT_LINE('LOADED FILE: '||v_filename
    || ' SIZE: ' || DBMS_LOB.GETLENGTH(v_file));
    DBMS_LOB.FILECLOSE(v_file);
    END load_bfile;
    EXEC load_bfile('BF');
    BEGIN load_bfile('BF'); END;
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    The system cannot find the file specified.
    ORA-06512: at "SYS.DBMS_LOB", line 504
    ORA-06512: at "SYS.LOAD_BFILE", line 8
    ORA-06512: at line 1
    These are the steps i have followed.Is anything wrong in these steps?.This all i have done connecting to local database only.

  • Error while trying to index a bfile

    hi,
    I have encountered the following error will trying to index a bfile . Following are the error messages, the listener.ora and creation script. I'm using a AIX Ver 4.3.3 J50 machine and my oracle version is 8.1.7 Thanks
    Creation Script
    SQL> create or replace directory DOC_DIR as '/u01/oradata/vs/documents/';
    Directory created.
    SQL> grant read on directory DOC_DIR to ctxsys;
    Grant succeeded.
    SQL> create table per_doc
    2 (per_id number primary key,
    3 doc1 bfile);
    SQL> insert into per_doc
    2 values
    3 (1,
    4 bfilename('DOC_DIR','816.doc'));
    ERROR ENCOUNTER
    create index doc_index on per_doc(doc1) indextype is ctxsys.context;
    exec(): 0509-036 Cannot load program /u05/app/oracle/product/8.1.7/ctx/bin/ctxhx because of the following errors:
    0509-150 Dependent module libsc_da.a(sc_da.o) could not be loaded.
    0509-022 Cannot load module libsc_da.a(sc_da.o).
    0509-026 System error: A file or directory in the path name does not exist.
    Index created.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u05/app/oracle/product/8.1.7)
    (ENVS =LD_LIBRARY_PATH=/u05/app/oracle/product/8.1.7/lib:/u05/app/oracle/product/8.1.7/ctx/lib)
    (PROGRAM = extproc)
    null

    Below is the .profile setting for Oracle
    ORACLE_BASE=/u05/app/oracle
    export ORACLE_BASE
    ORACLE_HOME=/u05/app/oracle/product/8.1.7
    export ORACLE_HOME
    LIBPATH=$ORACLE_HOME/lib:ORACLE_HOME/ctx/lib:/usr/lib:/lib
    export LIBPATH
    ORACLE_SID=vs
    export ORACLE_SID
    CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/product/jlib
    export CLASSPATH
    I have also granted the read access right to ctxsys as reflected below. Is there any other directories that I need to grant ctxsys access to?
    Thanks
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by aw choon hock ([email protected]):
    hi,
    I have encountered the following error will trying to index a bfile . Following are the error messages, the listener.ora and creation script. I'm using a AIX Ver 4.3.3 J50 machine and my oracle version is 8.1.7 Thanks
    Creation Script
    SQL> create or replace directory DOC_DIR as '/u01/oradata/vs/documents/';
    Directory created.
    SQL> grant read on directory DOC_DIR to ctxsys;
    Grant succeeded.
    SQL> create table per_doc
    2 (per_id number primary key,
    3 doc1 bfile);
    SQL> insert into per_doc
    2 values
    3 (1,
    4 bfilename('DOC_DIR','816.doc'));
    ERROR ENCOUNTER
    create index doc_index on per_doc(doc1) indextype is ctxsys.context;
    exec(): 0509-036 Cannot load program /u05/app/oracle/product/8.1.7/ctx/bin/ctxhx because of the following errors:
    0509-150 Dependent module libsc_da.a(sc_da.o) could not be loaded.
    0509-022 Cannot load module libsc_da.a(sc_da.o).
    0509-026 System error: A file or directory in the path name does not exist.
    Index created.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u05/app/oracle/product/8.1.7)
    (ENVS =LD_LIBRARY_PATH=/u05/app/oracle/product/8.1.7/lib:/u05/app/oracle/product/8.1.7/ctx/lib)
    (PROGRAM = extproc)
    )<HR></BLOCKQUOTE>
    null

  • BFileSample:  Error while selecting BFILE Locator java.sql.SQLException: ORA-22288:

    Hello, i have compiled and executed the BFileSample java standalone successfully. I am wondering how to use this in a production environment where there may be hundreds of image files stored categorically over a period of years? is it possible to use the BFILE_TABLE in conjunction w/ other tables e.g. use the BFILE_TABLE as fk to some table to query the oracle instance for select image files based on say some category: time, location and other relations? i have tried select * on BFILE_TABLE but i get the following errors:
    SQL> select BFILE_COLUMN from BFILE_TABLE;
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    Is the BFILE_TABLE usefull in anyway outside of the current implementation? thanx, david.

    Hi David,
    BFILE's are also called external LOB's, since data is stored in OS files outside the database and use reference semantics.
    Apart from conventional secondary storage devices such as hard disks, BFILEs may also be located on tertiary block storage devices such as CD-ROMs, PhotoCDs and DVDs.
    A table having BFILE column can be used like any other table, you can reference any column and have fk relationships. The only disadvantage of BFILE's is that backup doesn't happen automatically (since reference is only stored), the OS has to take care of backups of BFILE data.
    LOB's(BLOB, CLOB, BFILE) cannot be viewed in SQL Plus using selects, you can either get length or any associated attributes of these datatypes.
    example:
    select dbms_lob.getlength( BFILE_COLUMN) from bfile_table;
    I would suggest BFILE when you don't want to stress your tablespace(CLOB and BLOB sit on tablespace) and also when data need not be replicated .i.e if you copy a BFILE record, data is not copied, only the reference is copied(both reference will point to same file), but in case of CLOB and BLOB complete data is duplicated.
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96591/adl12bfl.htm#99013
    Hope this helps.
    Elango.

  • How to use bfile in forms

    Hi,
    I'm using webutil for viewing files(doc,pdf,txt).These files are stored in FTP server.
    But my requirement is i have to link that files with BFILE. means those file paths store in bfile. how to use bfile in forms.

    1. \forms\server\formsweb.cfg
    archive_jini=frmall_jinit.jar,FormsProperties.jar
    2. regedit
    HKEY_LOCAL_MACHINE => FORMS_BUILDER_CLASSPATH
    C:\DevSuiteHome_1\forms\java\frmbld.jar;C:\DevSuiteHome_1\jlib\importer.jar;
    C:\DevSuiteHome_1\jlib\debugger.jar;C:\DevSuiteHome_1\jlib\utj.jar;
    C:\DevSuiteHome_1\jlib\dfc.jar;C:\DevSuiteHome_1\jlib\help4.jar;
    C:\DevSuiteHome_1\jlib\oracle_ice.jar;C:\DevSuiteHome_1\jlib\jewt4.jar;
    C:\DevSuiteHome_1\jlib\ewt3.jar;C:\DevSuiteHome_1\jlib\share.jar;
    C:\DevSuiteHome_1\forms\java\frmwebutil.jar;C:\DevSuiteHome_1\forms\java\frmall.jar;
    C:\DevSuiteHome_1\forms\java\FormsProperties.jar;
    3. Untuk Jdev.. include..Libraries [THE WAY I AM CREATING A BEAN..NO NEED TO READ THIS]
    ORacle Forms
    C:\DevSuiteHome_1\jdev\lib\ext\frmjdev_pjc.jar

  • Get path and file name from Bfile

    Hi,
    I'm using Bfile to store images in a database. Is there a way to get the path and file name of the image from Bfile, because I need to pass that information into an image processing function.
    Many thanks.
    Sheldon

    Can you use FILEISOPEN in the DBMS_LOB package?
    See http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl03prg.htm#281893
    -- CJ

  • Need help on Reading BFILE, CLOB

    Hi all
    i am using Linux fedora 4
    i have created a directory
    create directory clob_dir as '/db10g/my_dir';
    and created a table from examples of a book i have
    CREATE TABLE BFILE_DOC
    (     ID INTEGER,
         BFILE_CLMN BFILE
    And a procedure to read a text file contents
    CREATE OR REPLACE
    PROCEDURE FILE_EXAMPLE (id_var in number) AS
    SRC_BFILE_VAR BFILE;
    DIR_ALIAS_VAR VARCHAR2(50);
    FILENAME_VAR VARCHAR2(50);
    CHUNK_SIZE_VAR INTEGER;
    LENGTH_VAR INTEGER;
    CHARS_READ_VAR INTEGER;
    DEST_CLOB_VAR NCLOB;
    AMOUNT_VAR INTEGER := 80;
    DEST_OFFSET_VAR INTEGER := 1;
    SRC_OFFSET_VAR INTEGER := 1;
    CHAR_BUFFER_VAR VARCHAR2(160);
    BEGIN
    SELECT BFILE_CLMN
    INTO SRC_BFILE_VAR
    FROM BFILE_DOC
    WHERE ID = id_var;
    DBMS_LOB.CREATETEMPORARY(DEST_CLOB_VAR, TRUE);
    IF (DBMS_LOB.FILEEXISTS(SRC_BFILE_VAR) = 1) THEN
    IF (DBMS_LOB.FILEISOPEN(SRC_BFILE_VAR) = 0) THEN
    DBMS_LOB.FILEOPEN(SRC_BFILE_VAR);
    DBMS_LOB.FILEGETNAME(SRC_BFILE_VAR,
    DIR_ALIAS_VAR,
    FILENAME_VAR);
    DBMS_OUTPUT.PUT_LINE('DIRECTORY NAME: ' || DIR_ALIAS_VAR);
    DBMS_OUTPUT.PUT_LINE('FILE NAME : ' || FILENAME_VAR );
    CHUNK_SIZE_VAR := DBMS_LOB.GETCHUNKSIZE(DEST_CLOB_VAR);
    DBMS_OUTPUT.PUT_LINE('CHUNK SIZE : ' || CHUNK_SIZE_VAR);
    LENGTH_VAR := DBMS_LOB.GETLENGTH(SRC_BFILE_VAR);
    DBMS_OUTPUT.PUT_LINE('LENGTH : ' || LENGTH_VAR);
    CHARS_READ_VAR := 0;
    WHILE (CHARS_READ_VAR < LENGTH_VAR) LOOP
    IF (LENGTH_VAR - CHARS_READ_VAR < AMOUNT_VAR) THEN
    AMOUNT_VAR := LENGTH_VAR - CHARS_READ_VAR;
    END IF;
    DBMS_LOB.LOADFROMFILE(DEST_CLOB_VAR, SRC_BFILE_VAR,
    AMOUNT_VAR, DEST_OFFSET_VAR,
    SRC_OFFSET_VAR + CHARS_READ_VAR);
    DBMS_LOB.READ(DEST_CLOB_VAR,
    AMOUNT_VAR,
    SRC_OFFSET_VAR,
    CHAR_BUFFER_VAR);
    DBMS_OUTPUT.PUT_LINE('CHAR BUFFER VAR:' || CHAR_BUFFER_VAR);
    CHARS_READ_VAR := CHARS_READ_VAR + AMOUNT_VAR;
    END LOOP;
    END IF ;
    END IF;
    DBMS_LOB.FILECLOSE(SRC_BFILE_VAR);
    DBMS_LOB.FREETEMPORARY(DEST_CLOB_VAR);
    END FILE_EXAMPLE;
    then i post a text file ( the size is 456.5 KB) in MY_DIR FOLDER
    the i inserted the informatin in that table
    INSERT INTO BFILE_DOC( ID , BFILE_CLMN)
    VALUES (1, BFILENAME('CLOB_DIR', 'abc.txt'));
    Then i called the procedure
    SQL> call file_example(1);
    here what i got
    CHAR BUFFER VAR:噁‰㐳㔠〵㨲㔠††††††††††††††䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    CHAR BUFFER VAR:†††ਠ㈹䙒††††㜷䈠⁇噁‰㔳㔠⁆剁‰†䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    CHAR BUFFER VAR:㜰㔠〱㨳〠††††††††††††††††䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    CHAR BUFFER VAR:†ਠ††††††䵁剉呉䴠䡏呅䰠††††††䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    CHAR BUFFER VAR:††††〶㨵㔠〹㨵㔠〶㨵㔠⁆剁†㜷㨴〠ਠ†䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    CHAR BUFFER VAR:〲䵏†‱㠶†㜷䈠⁆剁‱㈴㔠⁇噁‱㐰〠〱㨱†䥓单䕄㨠〷⼳〯〶†䩅䐠䉁卅†ਠⴭⴭⴭⴭ
    call file_example(1)
    ERROR at line 1:
    ORA-20000: ORU-10027: buffer overflow, limit of 1000000 bytes
    ORA-06512: at "SYS.DBMS_OUTPUT", line 32
    ORA-06512: at "SYS.DBMS_OUTPUT", line 97
    ORA-06512: at "SYS.DBMS_OUTPUT", line 112
    ORA-06512: at "SCOTT.FILE_EXAMPLE", line 51
    and here a sample of the content in the text file if i open it with text editor
    1 MO REPORT AT 12:35 EFFECTIVE SEP 04-SEP 18
    1 SA
    DAY FLT: EQP DEPARTS ARRIVES BLK. BLK: DUTY CR: LAYOVER
    MO 034 744 JED 1405 RUH 1540 01:35
    SAHARA AIRPORT HOTEL 01:35 03:35 01:35 RUH 19:05
    TU 1905 AB3 RUH 1045 TIF 1215 01:30
    TU 1904 AB3 TIF 1315 RUH 1440 01:25
    TU 1783 AB3 RUH 1540 GIZ 1730 01:50
    TU 1777 AB3 GIZ 1820 JED 1930 01:10
    05:55 10:45 05:55
    CREDIT_HRS: 07:30 BLK_HRS: 07:30 LDGS: 5 TAFB 31:25
    2 MO REPORT AT 21:25 EFFECTIVE SEP 04-SEP 18
    1 SA
    DAY FLT: EQP DEPARTS ARRIVES BLK. BLK: DUTY CR: LAYOVER
    MO 113 77B JED 2255 LHR 0520 06:25
    HILTON LONDON KENSIN 06:25 08:25 06:25 LHR 38:25
    WE 116 77B LHR 1945 JED 0150 06:05
    06:05 08:05 06:05
    CREDIT_HRS: 12:30 BLK_HRS: 12:30 LDGS: 2 TAFB 52:55
    ( the text file has more than 6000 line)
    notes:
    my ENV file ( bash_profile)
    # .db10g
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
         . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin; export PATH
    ORACLE_BASE=/db10g/app/oracle; export ORACLE_BASE
    ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
    ORACLE_SID=orcl; export ORACLE_SID
    ORACLE_TERM=xterm; export ORACLE_TERM
    PATH=/usr/sbin:$PATH; export PATH
    PATH=$ORACLE_HOME/bin:$PATH; export PATH
    NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NLS_LANG
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
    unset USERNAME
    The charset of the database is set to AL32UTF8. during the installtion time
    The questions :
    Whats wrong here?
    why i can not read the content of the txt file as it is ?
    i tried this issue in windows xp with SQL*PLUS, i got the same chars but no error.
    what to do to avoid the errors and to see the text file as its?
    how to load the content of the text file to CLOB Column if it is larger than 4000?
    thanks

    set serveroutput on
    BEGIN
    -- Enable DBMS_OUTPUT and set the buffer size. The buffer size can be between 1 and 1,000,000
    dbms_output.enable(1000000);
    END;
    check the datatypes of the supplied packages from the doumentation;
    dbms_output.put_line(item VARCHAR2);
    dbms_lob.read(
    lob_loc IN BLOB,
    amount IN OUT NOCOPY INTEGER,
    offset IN INTEGER,
    buffer OUT RAW);
    also sample usage of the package will help -> http://psoug.org/reference/dbms_lob.html

  • Is there any convenient way to work with BFILE column in EJB 3.0 projects

    Hi, all
    Can anybody answer this simple question?
    I know there is a special type - BFILEDomain in ADF BC, but what about EJB
    any links and advices would be greatly appreciated.
    Thanks in advance. Alex.

    This (similar) issue was filed as bug #7315754 in our bug tracking system.
    We do not support LOB, BLOB, BFILE datatypes as of now.
    All types which we don't recognize currently default to a field of type String. This mainly serves as a placeholder field that the user can refactor
    to any other desired type. Typically, when the JPA provider doesn't support the type, the field load/save operations can be managed, using hand-written
    JDBC code, inside @PrePersist or @PostPersist methods.

  • APEX BFILE

    I have to store graphical documents in an Oracle Database using Apex. I have designed an application based on the Sample Application for Customers, Product, Orders Page 3 and 6 using apex_util.get_blob_file_src and a File Browse Item to store the document in a BLOB field. That works perfectly.
    Now I had to change the application to store the BLOB content in a file and set a pointer in a BFILE column leaving the BLOB column empty. Therefore I wrote a view converting BFILE to BLOB and some instead of triggers to convert BLOB to BFILE.
    Then I rewrote my Apex pages using the view instead of the table. It doesn’t work. I noticed that when using the table Apex is first executing an INSERT leaving the BLOB empty and after that an UPDATE to fill the BLOB column when creating a new record. When using the view instead of the table the INSERT is executed but not the UPDATE.
    So I wanted to write a page process to update the table manually. But I found that there was no entry in the view APEX_APPLICATION_FILES generated by Apex. So I have no chance to obtain the BLOB value and use it to update my table.
    What can I do to have the BLOB content written by Apex to the table the view APEX_APPLICATION_FILES is selecting from?

    Hi
    WWV_FLOW_FILES uses APEX security mechanisms - so you cannot see any entry when selecting it
    from e.g. SQL*Plus. If you want to check the entries you need to use SQL Workshop.
    If you create a File Browse Item named P1_FILE you can select the BLOB content with
    declare
    v_lob blob;
    begin
    -- get uploaded content
    select CLOB_CONTENT into v_lob from wwv_flow_files where name = :P1_FILE;
    -- insert into own table
    insert into ...
    -- remove from WWV_FLOW_FILES after copying
    delete from wwv_flow_files where name = :P1_FILE;
    end;
    Note that you cannot insert into a BFILE - your target table column must be of the type BLOB
    Regards
    -Carsten

  • ORA-22275 with BFILE record processing

    Hi All,
    I'm processing records in a table that contains an optional bfile column and then comparing each record with another record from the same table. I'm getting "ORA-22275: Invalid LOB locator specified" when I get my comparison record using a function - and the cursor record contains a null bfile following a not null bfile record.
    Here's my simplified 11g test case:
    create table jr_test
    (pk_id number not null
    ,stuff varchar2(100) not null
    ,external_file bfile);
    insert into jr_test values (1,'Some other data',bfilename('MY_DIR','jr1.txt'));
    insert into jr_test values (2,'Some other data',bfilename('MY_DIR','jr2.txt'));
    insert into jr_test values (3,'No bfile',null);
    commit;
    DECLARE
       l_rec_1 jr_test%ROWTYPE;
       l_rec_2 jr_test%ROWTYPE;
       FUNCTION record_to_compare(p_id IN jr_test.pk_id%TYPE) RETURN jr_test%ROWTYPE IS
          l_rec jr_test%ROWTYPE;
       BEGIN
          SELECT *
          INTO   l_rec
          FROM   jr_test
          WHERE  pk_id = p_id;
          RETURN l_rec;
       END record_to_compare;
    BEGIN
       FOR x IN (SELECT *
                 FROM   jr_test
                 ORDER  BY pk_id /* desc */) -- ORA-22275 when order by pk_id asc
       LOOP
          l_rec_1 := x;
          -- Get another record (it's always the same one in this test case)
          l_rec_2 := record_to_compare(x.pk_id);
       END LOOP;
    END;With a descending order by clause (ie. null bfile first) it works OK.
    With an ascending order by clause (ie. not null bfiles first) it crashes with ORA-22275.
    It looks like a LOB initialisation problem, but I's welcome your comments.
    Regards
    JR

    Hello
    It doesn't actually appear to have anything to do with the order by as such, it is just the order in which the rows are accessed. I've modified your test case to just call the function in a specific order. However if I change to use a stored procedure with an OUT parameter, there is no such issue. I'll dig a bit more but maybe this helps narrow the field of search down a little...
    XXXX> declare
      2      l_rec_1 jr_test%ROWTYPE;
      3      l_rec_2 jr_test%ROWTYPE;
      4
      5      FUNCTION record_to_compare(p_id IN jr_test.pk_id%TYPE) RETURN jr_test%ROWTYPE IS
      6         l_rec jr_test%ROWTYPE;
      7      BEGIN
      8         SELECT *
      9         INTO   l_rec
    10         FROM   jr_test
    11         WHERE  pk_id = p_id;
    12
    13         RETURN l_rec;
    14      END record_to_compare;
    15
    16   BEGIN
    17
    18     -- Get another record (it's always the same one in this test case)
    19     l_rec_2 := record_to_compare(1);
    20     l_rec_2 := record_to_compare(2);
    21     l_rec_2 := record_to_compare(3);
    22
    23   END;
    24   /
    declare
    ERROR at line 1:
    ORA-22275: invalid LOB locator specified
    Elapsed: 00:00:00.12
    XXXX>
    XXXX>   declare
      2      l_rec_1 jr_test%ROWTYPE;
      3      l_rec_2 jr_test%ROWTYPE;
      4
      5      FUNCTION record_to_compare(p_id IN jr_test.pk_id%TYPE) RETURN jr_test%ROWTYPE IS
      6         l_rec jr_test%ROWTYPE;
      7      BEGIN
      8         SELECT *
      9         INTO   l_rec
    10         FROM   jr_test
    11         WHERE  pk_id = p_id;
    12
    13         RETURN l_rec;
    14      END record_to_compare;
    15
    16   BEGIN
    17
    18     -- Get another record (it's always the same one in this test case)
    19     l_rec_2 := record_to_compare(3);
    20     l_rec_2 := record_to_compare(2);
    21     l_rec_2 := record_to_compare(1);
    22
    23   END;
    24   /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    XXXX>
    XXXX>  declare
      2      l_rec_1 jr_test%ROWTYPE;
      3      l_rec_2 jr_test%ROWTYPE;
      4
      5      PROCEDURE record_to_compare
      6      (p_id IN jr_test.pk_id%TYPE,
      7       p_row out jr_test%ROWTYPE
      8      )
      9      IS
    10      BEGIN
    11         SELECT *
    12         INTO   p_row
    13         FROM   jr_test
    14         WHERE  pk_id = p_id;
    15      END;
    16
    17   BEGIN
    18
    19     -- Get another record (it's always the same one in this test case)
    20     record_to_compare(3,l_rec_2);
    21     record_to_compare(2,l_rec_2);
    22     record_to_compare(1,l_rec_2);
    23
    24   END;
    25   /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    XXXX>
    XXXX>    declare
      2      l_rec_1 jr_test%ROWTYPE;
      3      l_rec_2 jr_test%ROWTYPE;
      4
      5      PROCEDURE record_to_compare
      6      (p_id IN jr_test.pk_id%TYPE,
      7       p_row out jr_test%ROWTYPE
      8      )
      9      IS
    10      BEGIN
    11         SELECT *
    12         INTO   p_row
    13         FROM   jr_test
    14         WHERE  pk_id = p_id;
    15      END;
    16
    17   BEGIN
    18
    19     -- Get another record (it's always the same one in this test case)
    20     record_to_compare(1,l_rec_2);
    21     record_to_compare(2,l_rec_2);
    22     record_to_compare(3,l_rec_2);
    23
    24   END;
    25   /
    PL/SQL procedure successfully completed.HTH
    David

  • Download a PDF file with a Bfile field

    Hello, my name is Massimo and i'am looking for an jsp example where is possible download a PDF stored in a file system accessed with a Bfile column.
    Thanks

    Hi,
    I am guessing you want the data to go from the Database through the web server and to the User's Web Browser.
    You need to provide web access to the data.
    You can do this with the PL/SQL agent, a servlet or other techniques. Please look at the examples for the photo album. You can use ORDDOC to store the data.
    http://otn.oracle.com/sample_code/products/intermedia/index.html
    http://otn.oracle.com/software/products/intermedia/htdocs/descriptions/imedia_code_wizard.html

  • Using images stored in DB BFile columns

    Hi,
    I am using 11g r1p1 .. I have a DB table where I store images as BFile. What should I do to display these images on the page? I am using ADF stack..
    Thanks

    Hi Timo,
    I saw some of those but I thought that there would be a better and more out of box way of doing it.
    Looks like we can't just drag and drop an image column on the page.. We need to write code and maintain it for fulfilling a basic need , displaying a image..
    Thanks

  • Error while inserting data into BFILE datatype

    Dear Experts,
    I am trying to insert data into resume table, but it is throwing error:
    create table resume(resume blob);
    declare
    f_lob bfile;
    b_lob blob;
    begin
    insert into resume(resume) values(empty_blob())
    return documents into b_lob;
    f_lob := bfilename( 'RESUME_SAVE', 'Pawan-resume.doc' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile
    ( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    return documents into b_lob;
    ERROR at line 8:
    ORA-06550: line 8, column 10:
    PL/SQL: ORA-00904: "DOCUMENTS": invalid identifier
    ORA-06550: line 7, column 2:
    PL/SQL: SQL Statement ignored
    Please help
    Regards
    Sunil Kumar

    Thank you very much Mihael................... It works
    But I think there is a mistake in oracle documentation, please check following link:
    http://docs.oracle.com/cd/B10501_01/appdev.920/a96591/adl14cas.htm
    Thanks & Regards
    Sunil Kumar

  • Problem with BFILE closure

    I have a problem with a pending session (Oracle 8.1.7, Windows 2000). The active process is waiting for a BFILE to close (BFILE closure). It has been waiting > 7000 secs. The file to read is a simple csv-file with 10 lines.
    I'm using the widely spread "ftp"-package (I have removed all procedures with a "binary" part as 8i dont have the "put_raw" feature. I've used binary part of the package in 10g without any problems).
    The procedure where the problem occurs:
    FUNCTION get_local_ascii_data (p_dir IN VARCHAR2,
    p_file IN VARCHAR2)
    RETURN CLOB IS
    l_bfile BFILE;
    l_data CLOB;
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    wText varchar2(32767);
    BEGIN
    DBMS_LOB.createtemporary (lob_loc => l_data,
    cache => TRUE,
    dur => DBMS_LOB.call);
    l_bfile := BFILENAME(p_dir, p_file);
    DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
    DBMS_LOB.loadfromfile(l_data, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    RETURN l_data;
    END;
    The file to be read contains the following:
    1;john;heinrich;vejnavn 1;2650;hvidovre
    2;john;heinrich;vejnavn 2;2650;hvidovre
    3:john;heinrich;vejnavn 3;2650;hvidovre
    4;john;heinrich;vejnavn 4;2650;hvidovre
    5;john;heinrich;vejnavn 5;2650;hvidovre
    6;john;heinrich;vejnavn 6;2650;hvidovre
    7;john;heinrich;vejnavn 7;2650;hvidovre
    8;john;heinrich;vejnavn 8;2650;hvidovre
    9;john;heinrich;vejnavn 9;2650;hvidovre
    10;john;heinrich;vejnavn 10;2650;hvidovre
    Any clue?
    It locks the package in question, and killing the session dont free the package. Only a db shotdown will free the package. Is there a way to "close" the bfile?

    What information is there in your post indicating the BFILE did not close and that this is the cause of the problem?
    8.1.7 is so old I haven't seen it in almost a decade so I can't test this out but it seems to me you should be focusing new development efforts on a version of the product that has been supported during the current millennium.

  • Read a bfile and write its contents in a file stored in my hard disk

    I will try to describe my problem as clearly as I can.
    I have created a table that includes a LOB column "BFILE"
    Then I'm trying to READ the BFILE stored in our database using the
    DBMS_LOB package.
    so far so good.
    Now I want to write these data that I have read in the step above in a file
    saved in my local disk. The problem is, since the file in databse is
    stored as binary and I read Raw Data , I cannot create an exact copy of this
    file. It seems that It doesn't write the RAW data in the binary format.
    I have used the DBMS_LOB.READ to read the data and it works fine.
    Now I want to create a file in my local disk and dump the data that I have
    read from the BFILE that has been initially stored in the database.
    Is there any solution to this problem?
    I hope to hear from you soon
    Thanks in advance

    ignore me now.... I answered my own question a short while
    ago.
    for anyone who cares....
    I used CFHTTP to get the page and then used a cffile to write
    the #cfhttp.filecontent# into the new file!

Maybe you are looking for