TOraQuery and FOR UPDATE NOWAIT problem
TOraQuery and FOR UPDATE NOWAIT problem
Hi!
SELECT * FROM Table WHERE id=17 FOR UPDATE NOWAIT
in TOraQuery and then put Active=True
I get all the time "ORA-00907: missing right parenthesis"
I know the statement is OK...
How to execute it? Do I have to modify Open to Exec or what!?
P.S.
TOraQuery.IsQuery is true so I have automated procedures for executing queries...what lead me in problem?
SELECT * FROM Table WHERE id=17 FOR UPDATE NOWAIT
in TOraQuery and then put Active=True
I get all the time "ORA-00907: missing right parenthesis"
I know the statement is OK...
How to execute it? Do I have to modify Open to Exec or what!?
P.S.
TOraQuery.IsQuery is true so I have automated procedures for executing queries...what lead me in problem?
I have checked and error is somewher in my using TOraQuery but dont know where!???
Dear Alex!
Ihave and no error i shown!! I use TOraQuery through my custom function for executing SQL sequnces... Here is code of my RunSQLOra:
function RunSqlOra(SQLString:string; OraS:TOraSession; ErrorFileName:String=cs_MY_LOG_FILE): Longint;
begin
Result:=-1;
with UserSession do begin
try
OraQ.Close;
OraQ.Session:=OraS;
OraQ.SQL.Clear;
OraQ.SQL.Add(SQLString);
OraQ.Prepare;
if OraQ.IsQuery then begin
OraQ.Options.QueryRecCount:=True; // obvezno zbog SELECT Querija koji vraća broj slogova
OraQ.FetchAll:=True;
OraQ.Open;
Result:= OraQ.RecordCount;
end
else begin
OraQ.StrictUpdate := True;
OraQ.ExecSQL;
Result := OraQ.RowsAffected;
end;
except
on E:Exception do begin
try
usOraError:=E.Message;
LogSQLError(E.Message, OraQ);
finally
OraQ.Close;
end;
end;
end;
end;
end;
and
object OraQ: TOraQuery
Session = OraSessionUser
SQL.Strings = (
'SELECT * FROM KANDIDAT WHERE SIFRA=17 FOR UPDATE NOWAIT')
Options.QueryRecCount = True
AfterExecute = SmartQKandidatAfterExecute
OnUpdateError = SmartQKandidatUpdateError
AfterOpen = SmartQKandidatAfterOpen
OnDeleteError = SmartQKandidatEditError
OnEditError = SmartQKandidatEditError
OnPostError = SmartQKandidatEditError
Left = 400
Top = 216
end
where all After events are poor logging made through:
LogSQL(TOraQuery(sender));
Please what is wrong?
Ihave and no error i shown!! I use TOraQuery through my custom function for executing SQL sequnces... Here is code of my RunSQLOra:
function RunSqlOra(SQLString:string; OraS:TOraSession; ErrorFileName:String=cs_MY_LOG_FILE): Longint;
begin
Result:=-1;
with UserSession do begin
try
OraQ.Close;
OraQ.Session:=OraS;
OraQ.SQL.Clear;
OraQ.SQL.Add(SQLString);
OraQ.Prepare;
if OraQ.IsQuery then begin
OraQ.Options.QueryRecCount:=True; // obvezno zbog SELECT Querija koji vraća broj slogova
OraQ.FetchAll:=True;
OraQ.Open;
Result:= OraQ.RecordCount;
end
else begin
OraQ.StrictUpdate := True;
OraQ.ExecSQL;
Result := OraQ.RowsAffected;
end;
except
on E:Exception do begin
try
usOraError:=E.Message;
LogSQLError(E.Message, OraQ);
finally
OraQ.Close;
end;
end;
end;
end;
end;
and
object OraQ: TOraQuery
Session = OraSessionUser
SQL.Strings = (
'SELECT * FROM KANDIDAT WHERE SIFRA=17 FOR UPDATE NOWAIT')
Options.QueryRecCount = True
AfterExecute = SmartQKandidatAfterExecute
OnUpdateError = SmartQKandidatUpdateError
AfterOpen = SmartQKandidatAfterOpen
OnDeleteError = SmartQKandidatEditError
OnEditError = SmartQKandidatEditError
OnPostError = SmartQKandidatEditError
Left = 400
Top = 216
end
where all After events are poor logging made through:
LogSQL(TOraQuery(sender));
Please what is wrong?
here is more nicelly...sorry for previous post!
Code: Select all
function TIWUserSession.RunSqlOra(SQLString:string; OraS:TOraSession; ErrorFileName:String=cs_MY_LOG_FILE): Longint;
begin
Result:=-1;
with UserSession do begin
try
OraQ.Close;
OraQ.Session:=OraS;
OraQ.SQL.Clear;
OraQ.SQL.Add(SQLString);
OraQ.Prepare;
if OraQ.IsQuery then begin
OraQ.Options.QueryRecCount:=True; // obvezno zbog SELECT Querija koji vraća broj slogova
OraQ.FetchAll:=True;
OraQ.Open;
Result:= OraQ.RecordCount;
end
else begin
OraQ.StrictUpdate := True;
OraQ.ExecSQL;
Result := OraQ.RowsAffected;
end;
except
on E:Exception do begin
try
usOraError:=E.Message;
LogSQLError(E.Message, OraQ);
finally
OraQ.Close;
end;
end;
end;
end;
end;
Some notices...
Dear Alex,
here are some facts:
SQL is definatelly OK:
Here are some facts:
here are some facts:
SQL is definatelly OK:
Code: Select all
SELECT * FROM KANDIDAT WHERE SIFRA=17 FOR UPDATE NOWAIT
- When I put Active=True in Delphi IDE error is raised (same error message)
When I open Query Editor, and press Execute (on SQL Page) looks OK-no exception!!
When I choose "Data Editor" from Delphi IDE, and then Open, exception is raised (same error message)
Code: Select all
object OraQ: TOraQuery
Session = OraSessionUser
SQL.Strings = (
'SELECT * FROM KANDIDAT WHERE SIFRA=17 FOR UPDATE NOWAIT')
Options.QueryRecCount = True
AfterExecute = SmartQKandidatAfterExecute
AfterOpen = SmartQKandidatAfterOpen
Left = 400
Top = 216
end
Solve the problem
Hi1
If you set
Query is executed normally!!!
Hope this is nice example to put that on bug "fix list" for future release!
You're still great guys!
If you set
Code: Select all
QueryRecCount:=False;
Hope this is nice example to put that on bug "fix list" for future release!
You're still great guys!
TOraQuery sends SQL query to the server to get record count and cannot parse SELECT queries with
FOR UPDATE NOWAIT. You can see all statements that are executed on server if you set TOraQuery.Debug:=true and TOraSession.Debug:=True and include OdacVCL unit to the "uses" list.
If you want to use TOraQuery.Options.QueryRecordCount=true with locks please set
FOR UPDATE NOWAIT. You can see all statements that are executed on server if you set TOraQuery.Debug:=true and TOraSession.Debug:=True and include OdacVCL unit to the "uses" list.
If you want to use TOraQuery.Options.QueryRecordCount=true with locks please set
Code: Select all
OraQuery.SQL.Text := 'SELECT * FROM Table WHERE id=17';
OraQuery.SQLLock.Text := 'SELECT * FROM Table WHERE id=17 FOR UPDATE NOWAIT';
OraQuery.Open;
OraQuery.Lock;
one other thing...
Hi!
If I use your code (i.e. OraQ.lock) and use OraQ for some other queries in the meantime, table locked with OraQ stay locked forever, regaldless TOraSession.Rollback or not!?
Is that normal and if is how to unlock table locked in that way?
THX
If I use your code (i.e. OraQ.lock) and use OraQ for some other queries in the meantime, table locked with OraQ stay locked forever, regaldless TOraSession.Rollback or not!?
Is that normal and if is how to unlock table locked in that way?
THX