I have created a table like this:
CREATE TABLE photo (
phot_id number(100)
image blob);
I want to insert values ! But how ?
For example, I want to insert an image named nic.jpg which is in the directory C:\Oracle .... What must I do to insert the value in the table ?
hi
u have to first insert data like this...
Insert into <
>
Values(1,empty_blob());
use empty_blob() function for blob column...
and then write a procedure to insert data...
I am sending u my procedure Please manipulate it accordingly....
CRETE OR REPLACE PROCEDURE V_LOAD AS
ac Blob;
amount integer;
a_file bfile := BFILENAME('TEST', 'ITS1.GIF');
F_LEN NUMBER(6);
begin
update <
> set BLOB_FILE = empty_Blob()
where BLOB_ID = 1
returning BLOB_FILE into ac;
DBMS_LOB.FILEOPEN(a_file, dbms_lob.file_readonly);
F_LEN:=DBMS_LOB.GETLENGTH(A_FILE);
amount := F_LEN ;
DBMS_LOB.LOADFROMFILE(ac, a_file, amount);
DBMS_OUTPUT.PUT_LINE(F_LEN);
DBMS_LOB.FILECLOSE(a_file);
commit;
update <
>set BLOB_FILE = ac
where BLOB_ID = 1;
end;
this table has got only two fields....blob_file and blob_id...
then u can access this data with the help of query...
regards
Amit
Bookmarks