Results 1 to 4 of 4

Thread: Directory

  1. #1
    Join Date
    Jul 2005
    Posts
    36

    Question Unanswered: Directory

    Hello everybody, I have insert blobs into a table y Oracle but firstablea I created this

    CREATE OR REPLACE DIRECTORY DIRECTORIO AS 'C:\DIRECTORIO\'

    but I don't understand why? Because is it necesary? Can you explain it to me please?

    Thanks

  2. #2
    Join Date
    Sep 2004
    Posts
    60
    Inserting Blob into any table is requiring a directory to be created. This directory is the directory in OS, as location where your file will be stored (that need to be stored in blob field).
    I used a full procedure for this.

    How you are doing it ?? If any alternate method, please share.

    Refer following link for detailed code :

    http://www.orafaq.com/forum/t/44923/0/

  3. #3
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Quote Originally Posted by abhishekdixit
    Inserting Blob into any table is requiring a directory to be created.
    Just for other people that might read this, I think that you mean that if you want to store OS files as BLOBs, then you have to create an Oracle Directory object.

    There are many other uses for blobs which do not require a Directory, mainly when you want to store binary data sent from some application. (Please note that I don't speak of storing things that should be structured into the relational schema as unstructured data into Blobs. Not at all ! This should not be done of course.)

    Regards,

    rbaraer
    ORA-000TK : No bind variable detected... Shared Pool Alert code 5 - Nuclear query ready .

  4. #4
    Join Date
    Jul 2005
    Posts
    36
    HELLO, THANKS A LOT! I PUT HERE MY CODE TO DO IT OK? I WISH IT WOULD BE USEFULL FOR YOU.

    I have this table:
    create table ESQ_BD(
    Identificador varchar2(5) not null,
    Nombre varchar2(40) not null unique,
    Script clob,
    Extensional blob,
    Docum clob,
    Fecha date,
    Autor varchar2(40),
    Usuario varchar2(40) not null,
    Password varchar2(40) not null,
    Constraint pkesq primary key (identificador)
    );

    and what i do to insert clob and blob there:

    CREATE OR REPLACE DIRECTORY DIRECTORIO AS 'C:\DIRECTORIO\'


    CREATE OR REPLACE PROCEDURE agregaEsquema (directorio IN varchar2,identificador IN varchar2,nombre IN varchar2,scr IN varchar2, exten IN varchar2, document IN varchar2,fecha IN Date, autor IN varchar2, usuario IN varchar2, contraseña IN varchar2) as
    sc clob;
    sc_file bfile;
    ex blob;
    ex_file bfile;
    dc clob;
    dc_file bfile;
    BEGIN
    sc_file := bfilename(directorio, scr);
    ex_file := bfilename(directorio, exten);
    dc_file := bfilename(directorio, document);

    INSERT INTO ESQ_BD VALUES (identificador, nombre, empty_clob(),empty_blob(),empty_clob(),fecha,autor ,usuario,contraseña)
    RETURNING Script, Extensional, Docum into sc, ex, dc;

    dbms_lob.fileopen(sc_file,dbms_lob.file_readonly);
    dbms_lob.fileopen(ex_file,dbms_lob.file_readonly);
    dbms_lob.fileopen(dc_file,dbms_lob.file_readonly);


    dbms_lob.loadfromfile( sc, sc_file, dbms_lob.getlength (sc_file) );
    dbms_lob.loadfromfile( ex, ex_file, dbms_lob.getlength (ex_file) );
    dbms_lob.loadfromfile( dc, dc_file, dbms_lob.getlength (dc_file) );


    dbms_lob.fileclose(sc_file);
    dbms_lob.fileclose(ex_file);
    dbms_lob.fileclose(dc_file);
    commit;
    END;


    I THINK IT IS VERY SIMILAR (OR IGUAL) WHAT I HAVE SEEN BUT HOW KNOWS?

    REGARDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •