Rafal Szajowski wrote : >I would like to know how many records are updated by a single SQL statement. >I have checked the "Reference Manual: SAP DBVersions 7.2 and 7.3" and found >the following explanations of this problem:
>Page 127: >When rows are deleted from a referenced table, the number of rows deleted is >entered in the third SQLERRD entry in the SQLCA database. >Page 171: >In the case of the INSERT statement, the third entry of SQLERRD in the SQLCA >is set to the number of inserted rows. >Page 175: >In the case of the UPDATE statement, the third entry of SQLERRD in the SQLCA >is set to the number of updated rows. Rows are also counted as updated when >the old value was overwritten with a new but identical value. >Page 178: >In the case of the DELETE statement, the third entry of SQLERRD in the SQLCA >is set to the number of deleted rows. >Page 199: >The number of rows in the result table is returned in the SQLCA in the third >entry of SQLERRD. >That's all I've found. >I don't understand these explanations. I don't know how to use the SQLERRD >in a SQL >procedure and what the SQLERRD is. >I try to write a code like that: >UPDATE user_name.table_x >SET field_3 = :attribut_1 >WHERE field_2 = : attribut_2 AND field_3 = NULL; > IF field_3 = 'N' AND NUMBER_OF_UPDATED_RECORDS = 0 THEN >STOP(-4, 'Error, break the operation'); The explanations you found concern the SAPDB precompiler. In stored procedures you can check the system variable $COUNT for the number of updated rows : http://www.sapdb.org/htmhelp/a7/41ee29605911d3a98800a0c9449261/frameset.htm UPDATE user_name.table_x SET field_3 = :attribut_1 WHERE field_2 = : attribut_2 AND field_3 = NULL; IF field_3 = 'N' AND $COUNT = 0 THEN STOP(-4, 'Error, break the operation'); Thomas --- Thomas Anhaus SAPDB, SAP Labs Berlin _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
