Home » SQL & PL/SQL » SQL & PL/SQL » Reading images raises errors ! HOw to handle !? (oracle 11 windows)
Reading images raises errors ! HOw to handle !? [message #342164] Thu, 21 August 2008 10:40 Go to next message
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 #342165 is a reply to message #342164] Thu, 21 August 2008 10:46 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
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
Re: Reading images raises errors ! HOw to handle !? [message #342300 is a reply to message #342165] Thu, 21 August 2008 23:48 Go to previous messageGo to next message
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 #342314 is a reply to message #342300] Fri, 22 August 2008 00:31 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Follow the rules and you will have help from me.

Regards
Michel
Re: Reading images raises errors ! HOw to handle !? [message #342455 is a reply to message #342164] Fri, 22 August 2008 07:05 Go to previous messageGo to next message
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 #342456 is a reply to message #342455] Fri, 22 August 2008 07:10 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
So far as I know 29400 is not a names exception

Not quite true.
ORA-29400: data cartridge error\n%s
 *Cause:  An error has occurred in a data cartridge external procedure.
          This message will be followed by a second message giving
          more details about the data cartridge error.
 *Action: See the data cartridge documentation
          for an explanation of the second error message.

Regards
Michel
Re: Reading images raises errors ! HOw to handle !? [message #342460 is a reply to message #342456] Fri, 22 August 2008 07:23 Go to previous messageGo to next message
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 #342463 is a reply to message #342460] Fri, 22 August 2008 07:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Of course you knew they you're just a a-hole not an idiot.

Can you convert this sentence in a basic english as I don't understand it.

Also can you explain the purpose of the following sentence:
Quote:
So far as I know 29400 is not a names exception so you will need to declare is using PRAGMA EXCEPTION_INIT.

Maybe you thought about something but I don't see what we can do with it.

Regards
Michel
Re: Reading images raises errors ! HOw to handle !? [message #342467 is a reply to message #342463] Fri, 22 August 2008 07:40 Go to previous messageGo to next message
annagel
Messages: 220
Registered: April 2006
Senior Member
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.
Re: Reading images raises errors ! HOw to handle !? [message #342474 is a reply to message #342467] Fri, 22 August 2008 08:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
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 #342482 is a reply to message #342474] Fri, 22 August 2008 08:23 Go to previous messageGo to next message
annagel
Messages: 220
Registered: April 2006
Senior Member
Now I am confused, I quoted your mistake for you. I really can't make it any clearer than that.
Re: Reading images raises errors ! HOw to handle !? [message #342484 is a reply to message #342482] Fri, 22 August 2008 08:35 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Perhaps if we could all start behaving like adults, rather than primary school children, then we might be able to get back to the purpose of this forum - helping people with Oracle problems.
Re: Reading images raises errors ! HOw to handle !? [message #342490 is a reply to message #342484] Fri, 22 August 2008 09:08 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Perhaps you are right. Confused Embarassed
(But still don't understand what he said.)

Regards
Michel
Re: Reading images raises errors ! HOw to handle !? [message #342494 is a reply to message #342490] Fri, 22 August 2008 09:15 Go to previous messageGo to next message
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 #342497 is a reply to message #342494] Fri, 22 August 2008 09:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.oracle.com/pls/db102/search?word=named+exception&partno=
Quote:
Results 1 to 10 of about 125 for named exception. Didn't find any exact matches for this phrase; displaying results that contain all the words.

You can use the terms you want but you have to define them if you want we understand them correctly.

Regards
Michel

[Edit: Add end of the sentence]

[Updated on: Fri, 22 August 2008 09:38]

Report message to a moderator

Re: Reading images raises errors ! HOw to handle !? [message #342498 is a reply to message #342497] Fri, 22 August 2008 09:39 Go to previous messageGo to next message
annagel
Messages: 220
Registered: April 2006
Senior Member
Michel Cadot wrote on Fri, 22 August 2008 09:36
http://www.oracle.com/pls/db102/search?word=named+exception&partno=
Quote:
Results 1 to 10 of about 125 for named exception. Didn't find any exact matches for this phrase

You can use the terms you want but you have to define them if you want we understand them correctly.

Regards
Michel




Google search: oracle named exception

First result: link
Re: Reading images raises errors ! HOw to handle !? [message #342501 is a reply to message #342498] Fri, 22 August 2008 09:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
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

Re: Reading images raises errors ! HOw to handle !? [message #342504 is a reply to message #342501] Fri, 22 August 2008 09:46 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Now stop it please.
And no (but if...) additions, for that will only restart the "discussion"
Re: Reading images raises errors ! HOw to handle !? [message #342505 is a reply to message #342501] Fri, 22 August 2008 09:48 Go to previous messageGo to next message
annagel
Messages: 220
Registered: April 2006
Senior Member
Additionally the term is used in by "Ask Tom" in this post. My point is that the term is widely used to describe what I am describing, which again I am fairly certain you knew from the beginning as I am not under the illusion that you are an idiot.

Re: Reading images raises errors ! HOw to handle !? [message #342507 is a reply to message #342501] Fri, 22 August 2008 09:50 Go to previous messageGo to next message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
Not sure if this is correct, but when I read Steven's books I think he calls it "pl/sql named exceptions", also in this link I think

http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10807/07_errs.htm

P.S. Hi Sir JRowBottom!!!
Re: Reading images raises errors ! HOw to handle !? [message #342508 is a reply to message #342501] Fri, 22 August 2008 09:52 Go to previous message
ehegagoka
Messages: 493
Registered: July 2005
Senior Member
"predefine exception" - yeah I also have read this naming, I too get confused on the "terminologies" use by different authors.
Previous Topic: Problem in ordering and formatting month (merged)
Next Topic: Using Bulkinsert
Goto Forum:
  


Current Time: Fri Dec 09 01:47:55 CST 2016

Total time taken to generate the page: 0.14675 seconds