Hi Guys,
How do i insert a word document in to oracle database? What datatype should i use.
example:
I have a word document or a text file and i want this file to be inserted into oracle database....& what should be my datatype?
Printable View
Hi Guys,
How do i insert a word document in to oracle database? What datatype should i use.
example:
I have a word document or a text file and i want this file to be inserted into oracle database....& what should be my datatype?
There are examples in the manual. Lots of 'em.
search the development forum, I think I did post something there last fall.
BTW that was for castlerock, apparently he withdrew his post...
Hi,
I have inserted the word doc inside the database using the code below. How you i retrive it from the database. Any suggestions!
create or replace directory MY_FILES as 'C:\Uploadfolder';
Create table emp1
Create table emp1(
EMPNO number(30),
EMPNAMe varchar2(10),
RESUME BLOB);
To check the path is set in the dba_directories:
select * from dba_directories;
***************
declare
f_lob bfile;
b_lob blob;
begin
insert into emp1(empno,empname,resume)
values ( 1001, 'BILLGATES',empty_blob() )
return resume into b_lob;
-- resume is the field name in my table which has BLOB data type
f_lob := bfilename( 'MY_FILES', 'Purchase.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;
/
The doc is sucessfully inserted in the database .
How do i retrive the data back?
Thanks,
Using PL/SQL, you can retrieve LOBs/BLOBs using the routines in the DBMS_LOB package, ** BUT ** you must want to SHOW the contents, I believe. PL/SQL, being a "batch", "server-side" language, don´t know anything about .doc format, so you MUST use other tools/language (probably in client side) to do it : Forms is capable, Vb too, Delphi, C and some others.
Oracle sells some add-ons (intermedia) to do it inside the database, it is another option, or maybe java - the point is , with STANDARD PL/SQL & simple clients (like sql*plus), you CAN´T DO IT.
[]s
Chiappa