how to insert Blob values [message #914] |
Tue, 12 March 2002 12:16 |
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 |
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;
|
|
|
|
|