Returning rowid after insert by procedure

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Darlock
Posts: 1
Joined: Sat 05 Mar 2005 16:38

Returning rowid after insert by procedure

Post by Darlock » Sat 05 Mar 2005 16:50

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.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 09 Mar 2005 15:43

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

Post Reply