Putting a .pdf file into a column in an oracle table

I have created a table with one column as a blob so I can put 4800 .pdf files into that column of a table. Can anyone correct the ways I am trying to do this or let me know of a better way. I have tried several ways and have not been successful. Thanks.
Here are the two ways I have tried that haven't worked.
-- the storage table for the image file
CREATE TABLE pdm (
dname VARCHAR2(30), -- directory name
sname VARCHAR2(30), -- subdirectory name
fname VARCHAR2(30), -- file name
iblob BLOB); -- image file
-- create the procedure to load the file
CREATE OR REPLACE PROCEDURE load_file (
pdname VARCHAR2,
psname VARCHAR2,
pfname VARCHAR2) IS
src_file BFILE;
dst_file BLOB;
lgh_file BINARY_INTEGER;
BEGIN
src_file := bfilename('O:\twilliams\DD_promotion\cards\', pfname);
-- insert a NULL record to lock
INSERT INTO pdm
(dname, sname, fname, iblob)
VALUES
(pdname, psname, pfname, EMPTY_BLOB())
RETURNING iblob INTO dst_file;
-- lock record
SELECT iblob
INTO dst_file
FROM pdm
WHERE dname = pdname
AND sname = psname
AND fname = pfname
FOR UPDATE;
-- open the file
dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
-- determine length
lgh_file := dbms_lob.getlength(src_file);
-- read the file
dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
-- update the blob field
UPDATE pdm
SET iblob = dst_file
WHERE dname = pdname
AND sname = psname
AND fname = pfname;
-- close file
dbms_lob.fileclose(src_file);
END load_file;
This one I get an error message on this statements:(dbms_lob.LOADBLOBFROMFILE(blob_loc,bfile_loc,dbms_l ob.lobmaxsize,bfile_offset,
blob_offset) ; )
DECLARE
bfile_loc BFILE;
blob_loc BLOB;
bfile_offset NUMBER := 1;
blob_offset NUMBER := 1;
tot_len INTEGER;
BEGIN
/*-- First INSERT a row with an empty blob */
INSERT INTO blob_tab VALUES (5, EMPTY_BLOB());
COMMIT;
/*-- SELECT the blob locator FOR UPDATE */
SELECT blob_data INTO blob_loc FROM blob_tab
WHERE id = 5 FOR UPDATE;
/*- Obtain the BFILE locator */
bfile_loc := bfilename('O:\twilliams\DD_promotion\cards\','00EAL.pdf');
/*-- Open the input BFILE */
dbms_lob.fileopen(bfile_loc, dbms_lob.file_readonly);
/*-- Open the BLOB */
dbms_lob.OPEN(blob_loc, dbms_lob.lob_readwrite);
/*-- Populate the blob with the whole bfile data */
dbms_lob.LOADBLOBFROMFILE(blob_loc,bfile_loc,dbms_l ob.lobmaxsize,bfile_offset,
blob_offset) ;
/*-- Obtain length of the populated BLOB */
tot_len := DBMS_LOB.GETLENGTH(blob_loc);
/*-- Close the BLOB */
dbms_lob.close(blob_loc);
/*-- Close the BFILE */
dbms_lob.fileclose(bfile_loc);
COMMIT;
/*-- Display the length of the BLOB */
DBMS_OUTPUT.PUT_LINE('The length of the BLOB after population is: '||
TO_CHAR(tot_len));
END ;
/

CREATE TABLE test_blob (
id NUMBER(15)
, file_name VARCHAR2(1000)
, image BLOB
, timestamp DATE
CREATE OR REPLACE DIRECTORY
EXAMPLE_LOB_DIR
AS
'O:\twilliams\DD_promotion\cards\'
CREATE OR REPLACE PROCEDURE Load_BLOB_from_file_image
AS
dest_loc BLOB;
src_loc BFILE := BFILENAME('EXAMPLE_LOB_DIR', '009-1395.pdf');
BEGIN
INSERT INTO test_blob (id, file_name, image, timestamp)
VALUES (1001, '009-1395.pdf', empty_blob(), sysdate)
RETURNING image INTO dest_loc;
DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE(
dest_lob => dest_loc
, src_lob => src_loc
, amount => DBMS_LOB.getLength(src_loc));
DBMS_LOB.CLOSE(dest_loc);
DBMS_LOB.CLOSE(src_loc);
COMMIT;
END;
I am getting this error when I exec load_blob_from_file_image.
ERROR at line 1:
ORA-00972: identifier is too long
ORA-06512: at "SYS.DBMS_LOB", line 716
ORA-06512: at "DRAWING.LOADBLOBFROMFILEIMAGE", line 15
ORA-06512: at line 1
any ideas why?

Similar Messages

  • How to Upload a PDF file into BLOB column in a table using Forms 9i

    Can anyone tell me how to upload a PDF file from client system using File dialog window and store its content in BLOB column in a table. The file to be uploaded will be in client side.

    Hi,
    please, search a bit on the forum before do a question:
    Just searching by "upload blob pdf" ...
    How to batch upload PDF files into database BLOB
    Regards,
    Jose.

  • Can't put serveral PDF files into one document any more.

    I used to able to scan several PDF files into one document onto my desktop. I no longer can. I have Windows7 OS and a HP Photosmart 6515 printer.  PS. Just the other day I had someone remotely access my computer to fix a MagicJack (computer connected phone) issue and who knows what they might have done. Thank you anyone.
    This question was solved.
    View Solution.

    Thanks for all the time you spent to help me and all the effort you you put forth to solve mine and other's problems. God bless you.

  • How to Upload a PDF file into BLOB column in a table using Forms 6i

    Can anyone tell me how to upload a PDF file from client and store its content in BLOB column in a table. The file will be genered using reports and win be stored in db.The file to be uploaded will be in client side.
    Thank´s.

    If you are using version 9 or 10 use webutil.... Look in webutil.pll.
    Use either one these two fuctions...
    FUNCTION Client_To_DB( clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;
      FUNCTION Client_To_DB_With_Progress
                         (   clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             progressTitle    in VARCHAR2,
                             progressSubTitle in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;

  • How to batch upload PDF files into database BLOB

    Hello.
    I have a requirement to batch upload PDF files into BLOB column of an Oracle 8.1.7 table from Forms 6i Web. The content of the blob column (ie. the PDF content) MUST be displayable from all client software (eg. Oracle Web forms, HTML forms, etc.)
    Our environment is
    Middle-tier is 9iAS on Windows/2000
    Database is Oracle 8.1.7.0.0 on VMS
    Oracle Web Forms 6i Patch 10
    Basically my Oracle web form program will display a list of PDF files to upload and then the user can click on the <Upload> button to do the batch upload. I have experimented the following approaches but with no luck.
    1. READ_IMAGE_FILE forms built-in = does NOT work because it cannot read PDF file. I got error FRM-47100: Cannot read image file
    2. OCX and OLE form item = cannot use this because it does NOT work on the Web. I got error FRM-41344 OLE object not defined
    3. I cannot use DBMS_LOB to do the load because the PDF files are not in the database machine.
    4. Metalink Note 1682771.1 (How to upload binary documents back to database blob column from forms). When I used this, I got ORA-6502 during the hextoraw conversion. In using this solution, I have downloaded a bin2hex.exe from the Google site. I've noticed that when I looked at the converted HEX file, each line has the character : (colon) at the beginning of each line. I know the PDF file has been converted correctly to HEX format because when I convert the HEX file back to BIN format using hex2bin.exe, I'm able to display the converted bin file in Acrobat Reader. When I removed the : (colon) in the HEX file, I did NOT get the ORA-6502 error but I CANNOT display the file in Acrobat Reader. It gives an error "corrupted file".
    5. upload facility in PL/SQL Web toolkit - I tried to automatically submit the html form (with htp.p) but it does NOT load the contents of the file. I called the URL from Oracle forms using web.show_document. There seems to be issues with Oracle Web forms (JInitiator) and HTML (+ htp.p).
    The other options I can think of at this point are:
    1. Use SQL*Loader to do the batch upload via SQL*Net connection and use HOST() built-in from Oracle Webforms to execute SQL*Loader from the 9iAS.
    2. Write a Visual Basic program that reads a binary file and output the contents of the file into a byte array. Then build a DLL that can be called from Oracle webforms 6i via ORA_FFI. I don't prefer this because it means the solution will only work for Windows.
    3. Write a JSP program that streams the PDF file and insert the contents of the PDF file into blob column via JDBC. Call JSP from forms using web.show_document. With this I have to do another connection to the database when I load the file.
    4. Maybe I can use dbms_lob by using network file system (NFS) between the application server and VMS. But this will be network resource hungry as far as I know because the network connection has to be kept open.
    Please advise. Thank you.
    Regards,
    Armando

    I have downloaded a bin2hex.exe from the Google site.
    ... each line has the character : (colon) at the
    beginning of each line. I'm afraid it isn't a correct utility. I hope you'll find the source code of a correct one at metalink forum:
    Doc ID: 368771.996
    Type: Forum
    Subject: Uploading Binary Files: bin2hex and hex2bin do not reproduce the same file
    There is some links to metalink notes and some example about working with BLOB at http://www.tigralen.spb.ru/oracle/blob/index.htm. Maybe it helps. Sorry for my English. If there is any problem with code provided there, let me know by e-mail.

  • How to load PDF files into oracle database and display them in APEX

    Hi All,
    We have a requirement for loading the Loading PDF files (lots of PDf files) to the oracle database and then display the PDF files in the Oracel APEX report.
    So that User can view the PDF files. Our current APEX verison is 3.2..
    Please let me know how to implement it and where to find the sample application!
    Thanks in advanced!
    Jane

    Thanks Tony for your quick response!
    We need to load a lot of PDfs (history + current).
    I have a questions about the SQL loader. I am trying to insert a pdf file into a table by following the oracle loading sample:
    http://download.oracle.com/docs/cd/B10501_01/text.920/a96518/aload.htm
    Example Data File: loader2.dat
    This file contains the data to be loaded into each row of the table, articles_formatted.
    Each line contains a comma separated list of the fields to be loaded in articles_formatted. The last field of every line names the file to be loaded in to the text column:
    Ben Kanobi, plaintext,Kawasaki news article,../sample_docs/kawasaki.txt,
    But i don't know to where should I put my pdf file on the server.
    for example:
    ,../sample_docs/kawasaki.txt,
    Where is the file 'kawasaki.txt'??
    I try my local path, it didn't work. like c:\temp.
    then I loaded teh PDf file into our server(/findev20/olmtest/orafin/11.5.7/olmtestcomn/temp) , and In my data file. I put the path
    1, pdf_emp1,../findev20/olmtest/orafin/11.5.7/olmtestcomn/temp
    but I got the error: the system can not find the file specified.
    Where should I put the PDf files on the server and how to specify the path in the data file?
    Thanks!
    Jane

  • Load .bmp file into BLOB column in 9i - how to?

    Hello all,
    How do I update a table with a BLOB column with a .bmp file in 9i? I tried using the DBMS_LOB package but got a ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275 (and since there is more native support in 9i, I'm not sure I need it to begin with). We do not have Inter-Media. tia [email protected]

    Hi,
    please, search a bit on the forum before do a question:
    Just searching by "upload blob pdf" ...
    How to batch upload PDF files into database BLOB
    Regards,
    Jose.

  • Dropping in PDF files into iDVD? How?

    I have a client who would like to put some PDF files as well as video into a DVD I am making for here. What is the best way to throw some PDF's in? I would like a button that would point to those.
    Any help would be greatly appreciated?
    Best,
    Tom

    Hi Tom,
    You can include .pdf files (and any other kinds of files) in the DVD-ROM area of a DVD. Look under the Advanced menu for Edit DVD-ROM Contents. These won't display on a TV, but are accessible by a computer. To inform the viewer about this content, I mention it on the DVD jacket, and create a sub-menu that briefly describes what's in the DVD-ROM area. I suppose you could take a screenshot of the pdf and drop it into the background area of the sub-menu to give the TV viewer a small taste of what's in the computer-accessible area.
    John

  • Inserting PDF file into Clob

    Hi,
    I tried inserting PDF file into a CLOB column , in the below example l_bfile is a bfile datatype.
    and I'm inserting l_bfile to CLOB column.
    l_bfile := bfilename('C:\test', 'test.pdf');
    But It is throwing below error:
    ORA-06550: line 9, column 42:
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got FILE
    ORA-06550: line 9, column 1:
    PL/SQL: SQL Statement ignored
    Please advise me on this.
    thanks,
    Jagu
    Edited by: user11221603 on Oct 11, 2012 6:18 AM

    Hi,
    Check this thread: How to store PDF file in BLOB column without using indirect datastore
    Regards.
    Al

  • Loading external (PDF)file into BLOB colum in the table.  Need urgent help.

    Hi All,
    I've currently been working on loading many external binary files (PDF) into BLOB column. After some digging, I learn that the SQL*LOADER can be used to load data from external files into table. I also got help from another forummate mentioning to use PL/SQL procedure to do so. Since I have not done anything like this before. So, my question is what is the simple approach needed to upload PDF files into a table(there is only one table containing BLOB column in my database). In addition, the LOBs can not be query-able, I wanted to list the contents of the LOBs column to make sure that I did successfully upload data into the database. How can I do that?. I do need your help. Please direct me step by step how to do so. Your help is greatly appreciated.
    Regards,
    Trang

    Once the PDF file is inserted in the PDM table, i am not able to read the PDF data from the below code, This code converts the binary data into the Character data i.e BLOB data into the CLOB, but still the data is not proper which is getting inserted PDF is proprietary format of Adobe. And you cant just read it from pl/sql. You need Adobe software installed in your client machine to view it.
    Here is an example of how to do it.
    [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:232814159006] Display PDF Stored in Database from ASKTOM 

  • My ipod touch 4th generation won't synch.i'm trying to put a pdf file on it.please help thanks in advance...

    my ipod touch 4th generation won't synch.i'm trying to put a pdf file on it.please help thanks in advance...

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on anoterh computer to help determine if you have an iPod or computer problem.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
      Apple Retail Store - Genius Bar

  • I am trying to add a pdf file into my website which must be readable to all but must not be download able to anybody

    I am trying to add a pdf file into my website which must be readable to all but must not be download able to anybody.
    The document is about motivational topics likes short stories and quotes and the website is [link removed]
    If anybody is already using such interface please suggest.

    There is absolutely no way to stop any file you put on the internet from being downloaded. That's how the internet works.
    Digital Rights Management can control who can OPEN a copy of a file and when. If you are a big company with 5-6 figure budget, this can be interesting.

  • How can i stop the Action Wizard from putting the original file into the Source folder with my changed documents?

    How can i stop the Action Wizard from putting the original file into the Source folder with my changed documents?

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • I tried to convert a PDF file into Word and it gave me computer language

    I tried to convert a PDF file into word and it gave me computer language. Help!

    HI Aijan,
    I am trying to convert a pedigree chart so I can put it in my family's genealogy book. I need to make some corrections on it. It was created on a MAC and I am on a PC. This may be part of the problem. I am on Windows 8 on a 1-year old Samsung computer laptop. I have Adobe Reader XI on it. It says that I can convert a PDF to an Excel or Word file for editing.
    It looks like computer code to me.
    Here is the first page of what I am copying:
    Thanks for your help.
    Susan Cole
    4 :1.4;1 ,0/123140 )*+,
    !" (+ KA0 (>>*
    !," LAA,A3 CM     6" (> N8/ ()((
    6," -./&01.2&3 45
    2" ++ 5=: ()IH
    2," -./&01.2&3 45
    2 -./% ,0/123140 )*+,
    !" < 5=: ()(+
    !," -./&01.2&3 45
    6" +> %&' ()?<
    6," -./&01.2&3 45
    2" (+ @A9 ()>$
    2," %&1&0B C8B D,0.9:13 45
    5 <2.41%=1 ,>1 ',89?,
    !" (+ O'B (>>$
    !," -./&01.2&3 45
    2" (? KAE ()II
    2," -./&01.2&3 45
    1 !"#$% '$( )*+,
    !" $ %&' ()*+
    !,"-./&01.2&3 45
    6" ) %&' ()*
    6," 781 59:&;&13 45
    2"
    2,"
    6  -./% @1#21( 78',9
    !" +) @=; (>$I
    !," P&QA1           6" ++ %&' ()H)
    6," PA'86A3 R5
    2"
    2,"
    3 +."5#$ 6$44510 78',9
    !" +> @=9 ()(*
    !," 7E99 FA;;&E3 G43 4A9A2A 2" ?H 5=: ())I
    2," 4ABJ&20A; 4.BE3 45
    7 6$44510 A!$B$;1C !DEF6
    !," S9:;A92 2"
    2,"
    8 :1.4;1 6$0/$G$( )*+,                                                           !
    !" $ @=9 (>*+
    !," C898;=;=3 CM
    6" (I 5=: (>$I
    6," RA.6&A3 CM
    2" (I T&! ()(+
    2," -./&01.2&3 45
    9 H2$4$ D$451 9*@,++                                                              "
    !" +< T&! (>*I
    !," RA.6&A3 CM 2" (? T&! ()($
    2,"-&2;A9213 45
    10 @5225$I !0"$40 ',89?,                                                             #
    !" +< N8/ (><<
    !," 52&;A.2&3 5=1B0A;.A
    --Original Message

  • I am having a problem converting a scanned pdf file into Excel.

    I am having a problem converting a scanned pdf file into Excel. I do not get the columns and rows to align, just a single column of everything. Any suggestions?

    Export makes use of what is "in" a PDF.
    Good export is the "silk purse" and, ya know, you canna make a silk purse from a sow's ear (which is what any scanned image in PDF is with regards to export).
    The quality of export is dictated by the quality of the PDF. We are taking about the "inner essences" of the PDF (e.g., degree of compliance with the PDF Standard - ISO 32000-1).
    So, what goes in goes out or "GIGO".
    This has nothing to do with Acrobat or Acrobat's export process.
    A well-formed Tagged PDF (compliant to ISO 32000-1 & ISO 14289-1, PDF/UA-1) provides a PDF that proactively
    supports content export by Acrobat.
    To get the good stuff from export you start with a well-formed Tagged PDF.
    Goodstuff In — Goodstuff Out
    or
    Garbage In — Garbage Out
    "GIGO"
    Be well...
    Message was edited by: CtDave

Maybe you are looking for