|
|
|
|
Re: How to upload images into Oracle Table [message #625096 is a reply to message #625049] |
Wed, 01 October 2014 06:25 |
|
x-oracle
Messages: 380 Registered: April 2011 Location: gujarat
|
Senior Member |
|
|
Nasir Azeem i give you sm steps i did before.i use sql loader for upload jpg file into my database.follow this below stpes
STEP 1)
Create the table as follows
SQL> CREATE TABLE image_table (file_id NUMBER(5),
2 file_name VARCHAR2(30),file_data BLOB);
Table created.
STEP 2)
Create the control file as follows in notepad and just give a name control.ctl ....ctl extension is needed
LOAD DATA
INFILE *
INTO TABLE image_table
REPLACE
FIELDS TERMINATED BY ','
(
file_id INTEGER EXTERNAL(5),
file_name CHAR(30),
file_data LOBFILE (file_name)
TERMINATED BY EOF
)
BEGINDATA
1,F:\Koala.jpg
Step 3)
Run this command on command prompt
F:\oracle\product\10.2.0\db_1\bin>SQLLDR control=F:\rem\control.ctl
Username:system
Password:
SQL*Loader: Release 10.2.0.5.0 - Production on Thu Jun 9 16:20:17 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 1
F:\oracle\product\10.2.0\db_1\bin>
Step 4)
Now check this image file load in oracle by using this
F:\oracle\product\10.2.0\db_1\bin>sqlplus
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jun 9 16:37:58 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Enter user-name: ron
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show user
USER is "RON"
SQL>
SQL> Select file_id,file_name,DBMS_LOB.GETLENGTH(file_data ) Length from Image_table;
FILE_ID FILE_NAME LENGTH
---------- ------------------------------ ----------
1 F:\Koala.jpg 780831
SQL>
|
|
|
|
|
|