Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

Verzia 1 Ďalej »

DB_INSUPD a DBS_INSUPD actions


Function
The action is a merger of the actions DB_INSERT and DB_UPDATE (or DBS_INSERT and DBS_UPDATE). It works just with one row or more rows. If inserting a row fails (for any reasons), there is an assumption that inserting failed because of the reference integrity (unique key in database) and the action attempts to update existing row. There will be updated the columns, which are not part of the key, the key column(s) remains unchanged. The action is terminated successfully only if all the rows have been inserted or updated.
Declaration
DB_INSUPD handleIdent_Int, rowIdent, retCodeIdent_Int [ORAHINT hintIdent_Str]
 
DBS_INSUPD dbObjIden, rowIdent, retCodeIdent_Int [TRANS transHandle_Int] [ORAHINT hintIdent_Str]

 
or
 
DB_INSUPD handleIdent_Int, structIdent, retCodeIdent_Int [ORAHINT hintIdent_Str]
 
 DBS_INSUPD dbObjIdent, structIdent, retCodeIdent_Int [TRANS transHandle_Int] [ORAHINT hintIdent_Str]

Parameters
handleIdent_Int in Identifier of Int type - handle of connection with the database table (DB_CONNECT).
dbObjIdent in Reference to object of Database table type.
rowIdent in Identifier of one structure row (a row to insert).
structIdent in Identifier of entire structure (the rows to insert).
retCodeIdent_Int

out

Return code identifier.
transHandle_Int

in

Identifier of the connection to the database.
hintIdent_Str in Expression of String type that defines Oracle SQL hint. It is used as an instruction for the performance optimizer of SQL command. The value is used without the opening and terminating characters /*+ <orahint> */.
The example is mentioned here.

Return code
Value of the parameter retCodeIdent_Int - see the table of error codes. It is possible to get extended error information.
Since the version D2000 v7.01.010, the action DBS_INSUPD returns an error in case that the number of updated rows, by any row of structure,  is 0.
Description
Database table must be opened with the access rights _DB_MODIFY. Row or structure to be inserted must be of correct structure type. All items of each row to insert must contain valid values. There must be defined a key for the database table.

Advantage of the action DBS_INSUPD when working with a database table, is the possibility to leave out opening and closing the database table (easier declaration). Optimisation of the DBManager process (recycling connections, prepared connections) allows to execute the action DBS_INSUPD as quick as the action DB_INSUPD and the time necessary for processing the explicit command to open the database DB_CONNECT will be saved.

Related pages:

  • Žiadne štítky