Home » SQL & PL/SQL » SQL & PL/SQL » Save pdf file content to BLOB field in Oracle
Save pdf file content to BLOB field in Oracle [message #363371] Sat, 06 December 2008 05:19 Go to next message
hyma.akilla
Messages: 4
Registered: December 2008
Junior Member
Hi,
I want to know how to write a procedure in oracle to Save pdf file content to BLOB field in Oracle....Let me know any suggestions.
Thanks
Re: Save pdf file content to BLOB field in Oracle [message #363372 is a reply to message #363371] Sat, 06 December 2008 05:58 Go to previous messageGo to next message
karthick_arp@yahoo.com
Messages: 6
Registered: November 2006
Location: India
Junior Member

This should help

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:232814159006
Re: Save pdf file content to BLOB field in Oracle [message #363379 is a reply to message #363371] Sat, 06 December 2008 09:24 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.google.com/search?hl=en&q=oracle+pdf+blob&aq=f&oq=

Regards
Michel
Re: Save pdf file content to BLOB field in Oracle [message #364460 is a reply to message #363371] Mon, 08 December 2008 12:09 Go to previous messageGo to next message
hyma.akilla
Messages: 4
Registered: December 2008
Junior Member
I had read that entire asktom.com web page. But, I cant come to a conclusion.

If my pdf file is in "C;\Temp\a.pdf"

I am going to create a simple table:

CREATE TABLE graphics_table
(id NUMBER(9),
bfile_loc BFILE,
bfile_type VARCHAR2(10));

Then I created a directory:

CREATE OR REPLACE DIRECTORY dir AS 'C:\Temp\a.pdf';

Then when I started inserting in to graphics_table,

INSERT INTO graphics_table
(id,bfile_loc,bfile_type)
VALUES
(1,BFILENAME('dir','a.pdf'),pdf_file);

I am getting an error like this one:

Error at Line 4:
ORA-00984: Column not allowed here


Can anyone help me in this one

Thanks
Re: Save pdf file content to BLOB field in Oracle [message #364461 is a reply to message #364460] Mon, 08 December 2008 12:16 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
INSERT INTO graphics_table
(id,bfile_loc,bfile_type)
VALUES
(1,BFILENAME('dir','a.pdf'),pdf_file);

What is "pdf_file"? if it is a static string it should be enclose by '.

In addition:
Quote:
CREATE OR REPLACE DIRECTORY dir AS 'C:\Temp\a.pdf';

A directory is a directory not a file.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.

Use SQL*Plus and copy and paste your session when you post.

Regards
Michel

[Updated on: Mon, 08 December 2008 12:17]

Report message to a moderator

Re: Save pdf file content to BLOB field in Oracle [message #364465 is a reply to message #363371] Mon, 08 December 2008 12:45 Go to previous messageGo to next message
hyma.akilla
Messages: 4
Registered: December 2008
Junior Member
Yes, I am new to Oracle side. If the pdf file is in "C:\temp\a.pdf" .

Quote:
CREATE OR REPLACE DIRECTORY dir AS 'C:\Temp\a.pdf'


Is this the right command to create a directory for pdf file in "C:\Temp\a.pdf'

Thanks
Re: Save pdf file content to BLOB field in Oracle [message #364467 is a reply to message #364465] Mon, 08 December 2008 12:50 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
No.
You may be new to Oracle, but but you should know the difference between a directory and a file I would hope. C:\Temp\a.pdf is a file, not a directory.
Note that directory must exist on the server, not the client, and directory objects are referred to in UPPER CASE and enclosed in single quotes.

[Updated on: Mon, 08 December 2008 12:52]

Report message to a moderator

Re: Save pdf file content to BLOB field in Oracle [message #364470 is a reply to message #363371] Mon, 08 December 2008 13:15 Go to previous message
hyma.akilla
Messages: 4
Registered: December 2008
Junior Member
Thanks

Previous Topic: Creating Indexes
Next Topic: Need Help!!! (merged 4)
Goto Forum:
  


Current Time: Sat Dec 03 16:03:28 CST 2016

Total time taken to generate the page: 0.08682 seconds