Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Developer error reporting -- wrong line numbers

I'm tasked with writing and testing several small PL/SQL scripts. It's way outside my core competency, but I can do it with enough trial and error. One thing that complicates this process is the error reporting of SQ LDeveloper. It outputs a short description of the problem with a line and column number, but the line number bears no relation to where the error actually is. That is, I might have used = instead of := for assignment on line 52 of my script, but the error in the Script Output window says the problem in on line 37. In that a typical problem? Is there a way of converting the reported line number to an actual one?

I'm using SQL Developer 1.5.5.

like image 943
Greg Charles Avatar asked Jun 07 '12 21:06

Greg Charles


1 Answers

I know what you mean. I come across this issue on a daily basis. I still haven't totally figured out the exact solution but it seems to have something to do with how the compiler handles comments. I just did a test on my machine using a query where I inserted an error on a particular line. The Error at Line: # was off as expected. After removing the commented lines from the SQL the error corresponded to the Line #.

Edit: Adding test case in response to Ian Carpenter

select column1
       ,column2
--       ,column3
       ,column4
from table1
where 1=1
and column1 = '00000000';

Run then change to:

select column1
       ,column2
--       ,column3
       ,column4a
from table1
where 1=1
and column1 = '00000000';

Run and get following error:

ORA-00904: "COLUMN4A": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
Error at Line: 3 Column: 11
like image 56
tp9 Avatar answered Dec 25 '22 18:12

tp9