Home » SQL & PL/SQL » SQL & PL/SQL » how to insert Blob values
how to insert Blob values [message #914] Tue, 12 March 2002 12:16 Go to next message
Nishant Shah
Messages: 1
Registered: March 2002
Junior Member
Hi,

i am unable to insert values in my table which has following table description.

Table name : pdf_test

Column 1: pdf_tk number 8

Column 2 : pdf_blob blob type variable

i am writing this insert query and it says invalid hex number and error code is : ora-01465

insert into pdf_test (pdf_tk,pdf_blob) values ('9',:filename) using sqlca;

filename is my bind variable in powerbuilder application..whish is blob type.

here when i provide empty_blob() value to the blob cloumn it inserts row but not inserting values with my real data.

basically i am reading pdf file and inserting it in the database.

Any help will be appreciated.

Thanks,
Nishant
Re: how to insert Blob values [message #922 is a reply to message #914] Wed, 13 March 2002 01:07 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
hi, u r using wrong approach, here is an example how to read a gif-image to database. change it to read the pdf file, the basic principle is same.

hope it helps

SQL> desc blobs
Name Null? Type
------------------------------- -------- ----
ID VARCHAR2(255)
BLOB_COL BLOB

create directory My_files as 'c:temp';

procedure insert_img as
f_lob bfile;
b_lob blob;
begin
insert into blobs values ( 'MyGif', empty_blob() )
return blob_col into b_lob;
f_lob := bfilename( 'MY_FILES', 'c:tempemail.gif' );
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;
Re: how to insert Blob values [message #1348 is a reply to message #914] Tue, 23 April 2002 07:11 Go to previous messageGo to next message
scott
Messages: 73
Registered: September 1999
Member
I also am having the same problem. I think you need to use a procedure that open and closes the blob, but I don't know exactly how to do that.
Re: how to insert Blob values [message #2493 is a reply to message #922] Fri, 19 July 2002 14:38 Go to previous message
krishna
Messages: 141
Registered: October 1998
Senior Member
How do I extract an acrobat file from a BLOB?
Previous Topic: multiple "create trigger" commands in one script file
Next Topic: Index not being used
Goto Forum:
  


Current Time: Fri Mar 29 09:45:49 CDT 2024