Hello,
I am currently working on a project where I replace the formerly used ODAC components by the UniDac components.
In the application is a possibility to check the syntax of a sql statement the user can enter. To do this I used the TOraQuery component, prepared the statement, and, in case of an exception, I could use the property ErrorOffset to find out where exactly (more or less) the error appeared.
Now I moved to TUniQuery (as the application should also support SQL server now), but I don't find something like the formerly used ErrorOffset. As there are a lot of classes (maybe TUniQuery is not ideal for that purpose) I might have overlooked something.
Kind regards,
Thorsten
Edit: Maybe I should add that I use UniDac 5.5
Finding error position in statement
Re: Finding error position in statement
Hello,
This feature is specific for Oracle, therefore it is implemented only in ODAC. However, when working with UniDAC and OracleUniProvider, you can use the following code for retrieving this value:
This feature is specific for Oracle, therefore it is implemented only in ODAC. However, when working with UniDAC and OracleUniProvider, you can use the following code for retrieving this value:
Code: Select all
Uses ..., OraClassesUni;
function ErrorOffset(DataSet: TCustomDADataSet): integer;
var
v: variant;
begin
TDBAccessUtils.GetICommand(DataSet).GetProp(prErrorOffset, v);
Result := v;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
try
UniQuery1.Open;
except
ShowMessage(IntToStr(ErrorOffset(UniQuery1)));
end;
end;
Re: Finding error position in statement
Thank you, this works perfectly! 

Re: Finding error position in statement
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.