Page 1 of 1

Returning rowid after insert by procedure

Posted: Sat 05 Mar 2005 16:50
by Darlock
Hello.

I'am using TSmartOraQuery. Some properties:
SQL = 'select t.rowid, t.NAME, t.ID from table t TEST'
KEYFIELDS = 'ROWID'
KEYSEQUENCE = ''
SEQUENCEMODE = smInsert
SQLREFRESH = 'where rowid = :rowid'
SQLUPDATE = 'begin upd(:ROWID, :NAME); end;
SQLINSERT = 'begin ins(:NAME); end;

When user insert new record in grid and than step for next record - method INSERT occurs and record inserted into DB by procedure "ins". Then user step back for fist record and edit it. When he again step for next record method update occurs and :ROWID is NULL. How can I get ROWID for update after inserting?

Thanks.

Posted: Wed 09 Mar 2005 15:43
by Alex
You must use OLD_ prefix in parameter name to get required ROWID value e.g.

Code: Select all

SQLUPDATE = 'begin upd(:OLD_ROWID, :NAME); end;
Pls. see TCustomOraQuery.SQLUpdate , TCustomOraQuery.SQLInsert, TCustomOraQuery.SQLDelete, TCustomOraQuery.SQLRefresh and TCustomOraQuery.SQLLock topics in ODAC Help