Detailed error information

d.morose

Member
How to get detailed error information after
executing TOracleQuery? EOracleError is not enough, I need exact position, like in SQL*Plus "Error at line"

tnx
 
You can use TOracleQuery.ErrorLine and ErrorPosition to obtain this information. Both are 1-based.

------------------
Marco Kalter
Allround Automations
 
Marco, it works only with parse errors.
What to do with correct queries which produce
errors like "ORA-01438 value larger than specified precision allows for this column"?
ErrorLine and ErrorPosition will contain 1 but it's not true.
 
For run-time errors there is no error location. For example, "this column" in your ORA-01438 error message does not necessarily have to be included in the SQL text (select * from ...).

------------------
Marco Kalter
Allround Automations
 
Well, it's INSERT or UPDATE, not SELECT.
And SQL*Plus can locate error position, so why can't we? Some tricky OCI call?
 
I see. I tried this statement:

update dept
set deptno=100

The ErrorLine and ErrorPosition point to the location of "100".

What is your exact SQL statement, and what is your SQL*Net / Net8 version?

------------------
Marco Kalter
Allround Automations
 
oci.dll version 8.0.4.0.1
ora804.dll version 8.0.4.0.3
Tried both

ps: Then I opened help ...
I know I should did it before asking here.
Sorry for taking your time, Marco
Big thanks anyway

[This message has been edited by d.morose (edited 05 November 2002).]
 
pps: but one thing remains in fog for me...
SQL*Plus can do it with 8.0.4, so I guess DOA could do it too, not only with 8.0.5 and higher
 
Originally posted by d.morose:
... and it can, with TOracleSession.Preferences.UseOCI7:=true
:-)

further research results (hope it'll be helpful for someone else):

with above option set not any error can be located. For example,

select * from dept where deptno='char'

raise ORA-01722: invalid number and
ErrorLine=ErrorPosition=0, while with Net8 ver>=8.0.5 will point to 'char' position

I'm still wonder how SQL*Plus is doing it with _any_ version of SQL*Net/Net8

Marco?
 
This fails with UseOCI7 = True on 8.0.4, and succeeds on 8.0.5 and later?

------------------
Marco Kalter
Allround Automations
 
Uh, not exactly. With UseOCI7 = True fails both on 8.0.4 and 8.0.5

Summing it up:
UseOCI7=False & 8.0.4 - fails, as expected
UseOCI7=True & 8.0.4/5 - succeeds with some errors and fails with others
UseOCI7=False & 8.0.5 - succeeds with all errors

some mystery...
 
Back
Top