Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: exception messages...
In article <MPG.13a2c471d3194c5b989695_at_news.usenetserver.com>, news4
@REMOVEbaxnet.net says...
> I intentionally tried to insert a duplicate record, violating the prikey
> on rec A. I'm just trying to get to the point where I can trap these
> things as they happen at runtime, and deal with them effectively from my
> proc editor (I'm using SQL Nav by Quest s/w).
Nevermind, I figured it out. Try:
Exception
When others then
err_num := SQLCODE; err_msg := SUBSTR(SQLERRM, 1, 100); INSERT INTO runtime_errors VALUES (err_num, err_msg); dbms_output.put_line('Runtime Error '|| err_msg);end itall;
BTW - this works on 3 platforms, IRIX, 2000 and Sparc - so I'm assuming platform has little to do with it. It works with a 98 client, a Sun w/s sunOS env, and it also works with SQL+, TOAD and SQL Nav (Quest) on Microsoft. Actually as I come to find out, this is an extremely elementary problem which most heavies have long since worked out, and has been supported in the dbms_output package since 7.xx --
Alex
> So, it's something like this:
>
> Table A, column_one is prikey, of course no dupes.
>
> insert into A (column_one, column_two) values ('test', 'testing');
> --turn right around and do the same thing to purposely get the error
> insert into A (column_one, column_two) values ('test', 'testing');
>
> Now running it just shows "server threw an exception". When I figured
> it would. But I can't figure out what the execption actually is. So I
> did the following (this was some code from the Ora docs I found) :
>
> EXCEPTION
> WHEN NO_DATA_FOUND
> THEN
> NULL;
> WHEN OTHERS THEN
> err_num := SQLCODE;
> err_msg := SUBSTR(SQLERRM, 1, 100);
> INSERT INTO runtime_errors VALUES (err_num, err_msg);
> PLVexc.recNstop;
> END stoproc;
>
> Then this promptly blew up too, griping about lines being too long and
> such. Is it really that hard to just display an abend error with ORA?
>
>
>
Received on Sat Jun 03 2000 - 00:00:00 CDT