PDA

View Full Version : retrieving line of last error


fhermisch
02-25-02, 06:49
Hello !

Is it possible to get the line-number where the last error ocurred ?

At example:

CREATE OR REPLACE PROCEDURE do_stupid
IS

tempNum Number;

BEGIN

FOR i IN 1..5
LOOP
temp := sysdate;
END LOOP;

tempNum := 2;

tempNum := tempNum / 0;

tempNum := 3;

EXCEPTION
WHEN OTHERS THEN


-- i want to access the line-number of the error "tempnum / 0"

END do_stupid;

Thank You !

Florian

alligatorsql.com
02-25-02, 07:11
Hello,

you can access the errors of a compilation by using the following
SQL statement:

SELECT OWNER, NAME, TYPE, SEQUENCE, LINE, POSITION, TEXT
FROM SYS.ALL_ERRORS WHERE owner = 'SYS' AND name = 'NONAME';

or use the AlligatorSQL ;-)

Hope this helps ?

Manfred Peter
(Alligator Company)
http://www.alligatorsql.com

fhermisch
02-25-02, 07:54
I want to catch runtime Errors. A "Division by zero" doesnt throw a compilation error. The "Division by zero" should only be an example for everything which could throw an error - there could also be a "index not found" or anything else.