The process of storing a picture file, any development tool can store the picture text in the database by calling the procedure.
Detailed steps:
Microsoft Windows 5.00.2195 [Version]
(C) Copyright 1985-2000 Microsoft Corp.
C:\Documents and SETTINGS\CHANET>CD
C:\>sqlplus/nolog
Sql*plus:release 9.2.0.1.0-production on Wednesday January 19 14:46:21 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Sql> Connect chanet/chanet@oradb;
is connected.
Sql> CREATE TABLE Image_lob (t_id VARCHAR2 (5) Not null,t_image BLOB not NULL);
Table has been created.
sql> CREATE OR REPLACE DIRECTORY IMAGES as ' C:\Oracle '; --Photo Catalogue
The directory has been created.
sql> CREATE OR REPLACE PROCEDURE img_insert (TID varchar2,filename VARCHAR2) as
2 F_lob BFILE;
3 B_lob BLOB;
4 BEGIN
5 INSERT into Image_lob (t_id, T_image)
6 VALUES (Tid,empty_blob ()) return t_image into B_lob;
7 f_lob:= bfilename (' IMAGES ', FILENAME);
8 Dbms_lob. FILEOPEN (F_lob, Dbms_lob. FILE_READONLY);
9 Dbms_lob. LoadFromFile (B_lob, F_lob,
Ten Dbms_lob. GetLength (F_lob));
One by one dbms_lob. FileClose (F_LOB);
COMMIT;
The end;
14/
Procedure has been created.
sql>--sample
sql> EXEC Img_insert (' 1 ', ' f_test.jpg ');
The PL/SQL process has completed successfully.