What does the line number noted in an error specifically refer to?
Example:
When running a trigger, the following error occurs:
ora-06502... number precision too large
ora-06512: at "hms.dwr_update", line 194
ora-04088: error during execution of trigger 'hms.dwr_update'
ora-06512: at line 4
What is "line 194" referring to exactly? And what is "line 4"? It does not seem to correspond directly to the line numbers noted in the Editor window.
Start counting on the ‘DECLARE’ line, or if there isn’t one, then on the BEGIN’ line.
Example:
The trigger below will throw an error on line 5, because that long string is too big for the variable.
CREATE OR REPLACE TRIGGER JD.ERR_TRIG
AFTER DELETE
ON JD.TABLES
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
declare --1
a_varchar2 varchar2(10); --2
begin --3
-- error occurs on the line below --4
a_varchar2 := 'abcdefghjilkliklljhdsfsadf'; --5
end;
/