Do not use on any
shared computer
August 30, 2008 04:19am pdt
 
[x]
Attachment Details

BLOB input by ASP page

I followed those codes to insert some images to ORACLE database, it is fine (just did it by command), but I want to do it thorugh ASP page

Sample table
A      Varchar(10)
B      Varchar(20)
IMG   BLOB

1. ASP form
2. Input field A, B, browse Picture_1.gif from C:\temp folder, and then Submit
3. Insert to ORACLE database
   SQL ==> Insert INTO IMAGE  (A, B, IMG) VALUES ("123", "ABC", "?????")    
    ( ????? = C:\temp\Picture_1.gif)


How to do ?


Thanks !


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
http://www.experts-exchange.com/Database/Oracle/Q_20958688.html
...
 
3. Create directory:
 
SQL>create or replace directory dir_of_file as '/db01/test/';
Directory created.
 
4. Create a procedure:
 
 CREATE procedure file_into_blob(v_id IN varchar2,v_file_name IN varchar2)
 IS
 BEGIN
 DECLARE
 v_bfile bfile := BFILENAME('DIR_OF_FILE', v_file_name); -- note that uppercase
 v_lob blob;
 BEGIN
 insert into test(id,blob_col) values(v_id,empty_blob());
 select blob_col into v_lob from test where id = v_id for update;
 DBMS_LOB.FILEOPEN(v_bfile, DBMS_LOB.FILE_READONLY);
 DBMS_LOB.LOADFROMFILE ( v_lob, v_bfile, DBMS_LOB.GETLENGTH(v_bfile));
 DBMS_LOB.CLOSE(v_bfile);
 commit;
 END;
 END;
/
 
...
Start your free trial to view this solution
Question Stats
Zone: Database
Question Asked By: rhinoceros
Question Asked On: 05.20.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by schwertner

Rank: Genius

Expert Comment by schwertner:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by rhinoceros
Author Comment by rhinoceros:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by schwertner

Rank: Genius

Expert Comment by schwertner:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by schwertner

Rank: Genius

Expert Comment by schwertner:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628