cookiejar
asked on
ORACLE 10G - Update blob field with a jpeg
What is the syntax to update a blob field in ORACLE 10 g
For example:
Update table.blobfield with e:\jpegfile where table.keyid = '5'
For example:
Update table.blobfield with e:\jpegfile where table.keyid = '5'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CREATE TABLE imagetab
(imagfile BLOB);
TABLE created.
scott@ORA92> CREATE OR REPLACE DIRECTORY imagefiles AS 'd:\oracle'
2 /
DIRECTORY created.
DECLARE
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO imagetab (imagfile)
VALUES (EMPTY_BLOB())
RETURN imagfile INTO v_blob;
v_bfile := BFILENAME ('IMAGEFILES', 'p.bmp');
Dbms_Lob.fileopen (v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile (v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile ));
Dbms_Lob.Fileclose(v_bfile );
COMMIT;
END;
PL/SQL PROCEDURE successfully completed.
scott@ORA92>
SELECT * FROM imagetab
2 /
COUNT(*)
----------
1
scott@ORA92>
SELECT LENGTH (imagfile) FROM rajesh.imagetab
TRY THIS
(imagfile BLOB);
TABLE created.
scott@ORA92> CREATE OR REPLACE DIRECTORY imagefiles AS 'd:\oracle'
2 /
DIRECTORY created.
DECLARE
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO imagetab (imagfile)
VALUES (EMPTY_BLOB())
RETURN imagfile INTO v_blob;
v_bfile := BFILENAME ('IMAGEFILES', 'p.bmp');
Dbms_Lob.fileopen (v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile (v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile
Dbms_Lob.Fileclose(v_bfile
COMMIT;
END;
PL/SQL PROCEDURE successfully completed.
scott@ORA92>
SELECT * FROM imagetab
2 /
COUNT(*)
----------
1
scott@ORA92>
SELECT LENGTH (imagfile) FROM rajesh.imagetab
TRY THIS
ASKER