Home » SQL & PL/SQL » SQL & PL/SQL » How to upload images into Oracle Table (Window7)
How to upload images into Oracle Table [message #625013] Tue, 30 September 2014 05:37 Go to next message
Nasir.azeem
Messages: 40
Registered: September 2014
Location: Karachi
Member
Dear All,
How to upload every employee iamges into scott.emp table. iam doing first time this work. kindly help me

Regard

Nasir Azeem.
Re: How to upload images into Oracle Table [message #625016 is a reply to message #625013] Tue, 30 September 2014 06:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Add a BLOB column and use DBMS_LOB package (from instance LOADBLOBFROMFILE procedure).

Re: How to upload images into Oracle Table [message #625048 is a reply to message #625016] Tue, 30 September 2014 10:56 Go to previous messageGo to next message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member

1.It is not necessary to upload the image into the table.
2.Put actual image file at some location. --/home/oracle/images/Desert.jpg
3.Make a column image_path varchar2(400).
4.Store path in the column image_path of actual location.--'/home/oracle/images/Desert.jpg'

[Updated on: Tue, 30 September 2014 10:57]

Report message to a moderator

Re: How to upload images into Oracle Table [message #625049 is a reply to message #625048] Tue, 30 September 2014 11:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

5. And you lose the transactional processing and backup of your image

Re: How to upload images into Oracle Table [message #625096 is a reply to message #625049] Wed, 01 October 2014 06:25 Go to previous messageGo to next message
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>
Re: How to upload images into Oracle Table [message #625099 is a reply to message #625096] Wed, 01 October 2014 06:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Nice demo. /forum/fa/2115/0/

icon6.gif  Re: How to upload images into Oracle Table [message #625102 is a reply to message #625099] Wed, 01 October 2014 06:38 Go to previous messageGo to next message
x-oracle
Messages: 380
Registered: April 2011
Location: gujarat
Senior Member
thnks Michel Cadot
Re: How to upload images into Oracle Table [message #625103 is a reply to message #625099] Wed, 01 October 2014 06:45 Go to previous message
Nasir.azeem
Messages: 40
Registered: September 2014
Location: Karachi
Member
Thank you sir because you have falcon eye on my matter Smile
Previous Topic: Help with pre 9i Join to ANSI standard
Next Topic: SQL Query
Goto Forum:
  


Current Time: Thu Apr 25 11:00:33 CDT 2024