Reading images raises errors ! HOw to handle !? [message #342164] |
Thu, 21 August 2008 10:40 |
doumit2
Messages: 2 Registered: August 2008
|
Junior Member |
|
|
Well I'm stuck!
I'm gonna try to describe the situation as clear as i can.
My goal is to read images from a folder and to store them in a table ('images') field under SI_STILLImage format.
I have in another table ( 'log' ) the filenames of the images.
So to insert in the 'images' table i must read the filename from the 'log' table and then read the image itself and insert it.
Apparently my code has worked but when i've tried it to a folder containing some 6000 photos the program was only able to read 5000 !! And some errors showed up.
DECLARE
Dir varchar(20);
CURSOR cur IS
SELECT num
FROM tab_index;
rec cur%ROWTYPE;
lobd blob;
fils BFILE;
Num number;
BEGIN
OPEN cur;
LOOP
FETCH cur INTO rec;
EXIT WHEN cur%NOTFOUND;
Num :=rec.num;
Dir :=Num||'.bmp';
Fils := BFILENAME('FILE_DIR', Dir );
DBMS_LOB.CREATETEMPORARY(lobd, TRUE);
DBMS_LOB.fileopen(fils, DBMS_LOB.file_readonly);
DBMS_LOB.LOADFROMFILE(lobd, fils,DBMS_LOB.GETLENGTH(fils));
DBMS_LOB.FILECLOSE(fils);
INSERT INTO images (id, pic)
VALUES(Num, new ORDSYS.SI_StillImage(lobd));
DBMS_LOB.FREETEMPORARY(lobd);
COMMIT;
END LOOP;
CLOSE cur;
END;
/
-----------------------------------------------------------------
Error at line 1:
ORA-29400: data cartridge error
IMG-00705: unsupported or corrupted input format
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 75
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 65
ORA-06512: at "ORDSYS.ORDIMG_PKG", line 47
ORA-06512: at "ORDSYS.ORDIMAGE", line 786
ORA-06512: at "ORDSYS.SI_STILLIMAGE", line 58
ORA-06512: at line 23
--------------------------------------------------------------------
So how can i resolve this problem ?!
And if it can not be resolve I must find a way to 'CATCH' the error and continue !
In other words if a certain image is corrupted i want to skip it and continue without interrupting the program !
Is there any way to help me ! I really need this to work !
Thanks in advance
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342300 is a reply to message #342165] |
Thu, 21 August 2008 23:48 |
doumit2
Messages: 2 Registered: August 2008
|
Junior Member |
|
|
Michel Cadot wrote on Thu, 21 August 2008 10:46 | Why do you create a new user for a new topic?
And you still don't follow guidelines with this new user.
As said in your previous life: read them, follow them.
Regards
Michel
|
Your reply did not help !
I don't get it dude why did you create a new user if you don't wanna share info ?!
Stop showing off and give us something useful!
Thanks Michel
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342455 is a reply to message #342164] |
Fri, 22 August 2008 07:05 |
annagel
Messages: 220 Registered: April 2006
|
Senior Member |
|
|
An exception block will allow you to catch the error. So far as I know 29400 is not a names exception so you will need to declare is using PRAGMA EXCEPTION_INIT.
As for why the problem is occurring in the first place have you considered the possibility that the test of the error message might be there to help you and not to throw you off the right track so I would probably try checking to see if maybe the image being loaded when the error occurred was caused by an unsupported or corrupted image format.
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342460 is a reply to message #342456] |
Fri, 22 August 2008 07:23 |
annagel
Messages: 220 Registered: April 2006
|
Senior Member |
|
|
A named exception as I am using the term here (which would be obvious from my subsequent reference to the fact that he would first need to declare an exception type with PRAGMS EXCEPTION_INIT to catch it) refers to exceptions like NO_DATA_FOUND, ZERO_DIVIDE, and the like which come with names already defined by default. Of course you knew they you're just a a-hole not an idiot.
|
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342474 is a reply to message #342467] |
Fri, 22 August 2008 08:00 |
|
Michel Cadot
Messages: 68722 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
annagel wrote on Fri, 22 August 2008 14:40 | Michel Cadot wrote on Fri, 22 August 2008 07:30 |
Can you convert this sentence in a basic english as I don't understand it.
|
Point of advice if you are going to criticize the mistypes of others it is usually best not to make one yourself.
|
Which one?
It seems you have many things in your head but don't post them. Maybe they are obvious for you but it is not for us to read in your mind.
Regards
Michel
[Updated on: Fri, 22 August 2008 08:01] Report message to a moderator
|
|
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342494 is a reply to message #342490] |
Fri, 22 August 2008 09:15 |
annagel
Messages: 220 Registered: April 2006
|
Senior Member |
|
|
Michel Cadot wrote on Fri, 22 August 2008 09:08 | (But still don't understand what he said.)
|
The original post edited for typos (emphasis added for the correction):
Quote: | So far as I know 29400 is not a named exception so you will need to declare it using PRAGMA EXCEPTION_INIT.
|
|
|
|
|
|
Re: Reading images raises errors ! HOw to handle !? [message #342501 is a reply to message #342498] |
Fri, 22 August 2008 09:42 |
|
Michel Cadot
Messages: 68722 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
This site can use the terms it wants as you have the same right and everyone can use the terms it wants; do you think we have to search on Google each time you post something to understand it.
Just use Oracle documentation definitions, this is the only common one.
The correct term is "predefined exception", if you used it there would be no misunderstanding.
Regards
Michel
[Updated on: Fri, 22 August 2008 09:45] Report message to a moderator
|
|
|
|
|
|
|