oracle query. rowid

umayr

Member²
Hi

I am using tdataset.onapplyrecord to insert
to my table.
Code for my toracledataset.onapplyrecord :

if Action = 'I' then
begin
OdsPerson.DeclareQueryVariables(PersonInsertQuery);
OdsPerson.SetQueryVariables(PersonInsertQuery);
PersonInsertQuery.Execute;
NewRowId := personInsertQuery.Rowid;
Applied := True;
end;

My toraclequery (PersonInsertquery) does NOT return the rowid??? How can I get hold of the rowid. The record gets inserted though.

Thanks in advance
Ushaf
 
Hi

I have tried the following code
Orq1.SQL.text := 'Insert into events (eventid,caseid) values (1,''0001'')';
Orq1.execute;
Ors1.Commit;
Showmessage(Orq1.rowid);

On one system it returns with a valid row id but on another one it returned 000.0000.000

Does anybody have any idea when/why/how this could occur? THere is no error reported in either case.. please help..

Thanks
ushaf
 
This is a known problem on certain Client / Server combinations. Use the returning clause instead:

Known problems
==============
TOracleQuery.Rowid will not return a correct value when connected to Oracle8 8.0 through Net8 8.1. This is a Net8 8.1 bug, that can be circumvented by using the returning ... into clause. For example:
Code:
insert into ...
    returning rowid into :v_rowid
Declaring the :v_rowid variable as a string will return the correct rowid into the variable after the statement is executed.

------------------
Marco Kalter
Allround Automations
 
Back
Top