Tuesday, March 20, 2012

retrieving line of last error

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 !

FlorianHello,

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|||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.

No comments:

Post a Comment