473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

updating table with two images

I have table with columns id(number), photo(blob) and thumbnail(blob). I
would like to insert image (using stored procedure) from file to column
photo and in same time copy reduced image to column thumbnail. My code is:
CREATE OR REPLACE PROCEDURE "MDEMO"."PUT_PHOTO_THUMB"
(

image_file_directory in varchar2,
image_file_name in varchar2,
image_file_mime_type in varchar2,
image_http_path in varchar2,
image_http_name in varchar2,
ord_procedure_path in varchar2,
ord_content_type in varchar2,
ord_content_blob out blob
)
as
localImage ordsys.ordimage;
localThumb ordsys.ordimage;
begin
/*
* Create an empty object.
*/
localImage := ordsys.ordimage( ordsys.ordsource( empty_blob(),
null,
null,
null,
null,
null ),
null,
null,
null,
null,
null,
null,
null );
localThumb := ordsys.ordimage( ordsys.ordsource( empty_blob(),
null,
null,
null,
null,
null ),
null,
null,
null,
null,
null,
null,
null );

/*
* Process the request based on the location of the new image.
*/
if length( image_file_directory ) > 0 then
/*
* Image is stored as a FILE in a database server directory.
* Set the local image object to reference the specified file.
*/
localImage.clearLocal();
localImage.setSource( 'FILE',
image_file_directory,
image_file_name );
localImage.setMimeType( image_file_mime_type );
elsif length ( image_http_path ) > 0 then
/*
* Image is stored on a web server somewhere.
* Set the local image object to reference the URL.
*/
localImage.clearLocal();
localImage.setSource( 'HTTP',
image_http_path,
image_http_name );

else
/*
* Image is being uploaded from the client to be stored in the
database.
* Set the flag to indicate the image is to be stored in the object's
* local-data BLOB.
*/
localImage.setLocal();
localImage.setMimeType( ord_content_type );
localThumb.setMimeType( ord_content_type );
/* copy reduced image from localImage to localThumb*/
localImage.processCopy('maxScale=50,50',localThumb );
end if;

/*
* Update the image object in the table. If the image is to be stored in
* the object's local-data BLOB, then return the LOB handle so the web
* agent can store the image in the database.
*/

if localImage.isLocal() then
update MPHOTOS i set i.IMAGE = localImage where ID =
ord_procedure_path
return i.IMAGE.source.localdata into ord_content_blob;

update MPHOTOS i set i.THUMB = localThumb where ID =
ord_procedure_path
return i.THUMB.source.localdata into ord_content_blob;
else
update MPHOTOS i set i.IMAGE = localImage where ID =
ord_procedure_path;
update MPHOTOS i set i.THUMB = localThumb where ID =
ord_procedure_path;
end if;

end;

/
SHOW ERRORS;

When I want to execute (using intermedia clipboard) I receive a message
"invalid LOB locator specified". What is wrong?

Thanx in advance
--
--
,-._|\ Vladimir Kanovnik Melbourne PC UsersGroup
/ Oz \ Email: vl**@melbpc.org.au
\_,--.x/ Phone: +61 3 9791 1409
v Fax: +61 3 9791 1946
Mobile: +61 412 134012
~~ Australia ~~
Jul 19 '05 #1
0 2588

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David P. Donahue | last post by:
I'm using the following code to add a row to a table (for holding images) in my database (obtained from http://www.codeproject.com/aspnet/image_asp.asp?df=100&forumid=38225&select=1038401): ...
3
by: Jim Cobban | last post by:
I have a set of web pages that are organized in pairs. One of each pair contains a graphic and the other is an extended description of the graphic. I am trying to set it up that selecting a single...
3
by: Katy | last post by:
In my project I have two tables with the same structure and second table's data is a part of the first one. (one is the main and the second is used to keep the results of filters performed on the...
0
by: Mike P | last post by:
I have a formview which has exactly the same parameters as a detailsview, but I get an error when I try to update when editing the formview. Here are my update parameters : <UpdateParameters>...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
3
by: Trez | last post by:
Hey guys, Am new at using ASP.Net. am having some problems updating my SQL DB. whenever i try i get this Error. Can someone help me? Incorrect syntax near 'nvarchar'. Description: An unhandled...
0
by: Jankie | last post by:
Hey you all ! Happy holidays ! I have 2 tables: Ads ad_id primary ... ..
5
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the...
0
by: John Mason | last post by:
Hi, I've been trying for most of the day to get a FormView control to work. I would like to display a single record, based on a unique user id (loginid), which I am retreiving from a cookie. No...
10
by: Humakt | last post by:
Hey all. It's been a while since I last visited. Short description of program: Board game which's html elements are fully constructed using DHTML/Javascript. Board is constructed of html table,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.