1

I have to save a PDF-File into a BLOB-Column from a Oracle DB. I can't use Java and have to use an INSERT-Statement.

The only solutions I've found while searching were very complex.

Is there an easy solution like: INSERT INTO (BLOB_COLUMN) VALUES(BLOBPDF("myPDF.pdf") or something like that?

3
  • There are no such shortcuts when it comes to BLOBs. Try to understand those complex solutions, try to implement them and if at all you face any problems, post a question here. Commented Jan 29, 2014 at 14:52
  • That would be something your SQL client tool needs to support - unless you can copy the file to the database server. Then you could do that using PL/SQL Commented Jan 29, 2014 at 14:56
  • Convert the bytes to hexadecimal digits, then pass them to HEXTORAW inside INSERT. Commented Jan 29, 2014 at 15:04

2 Answers 2

1

I would suggest that you use a stored procedure in Oracle where you pass the path to your PDF file and calling the stored procedure does the insert.

Look at the last two sample example here.

Sign up to request clarification or add additional context in comments.

2 Comments

Thx for you answer. I think you have forgotten the links to the examples.
Added, you might want to know how stored procedures are created in Oracle and use them.Ideally, I would have used s3 to store files rather than storing them in the database.
0

If the load is "one-shot" you can use SQLDeveloper. Otherwise you can use sqlloader (http://docs.oracle.com/cd/B19306_01/server.102/b14215/ldr_params.htm) that is designed for this type of operations

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.