https://bugs.documentfoundation.org/show_bug.cgi?id=124340
--- Comment #8 from Robert Großkopf <[email protected]> --- There are different problems reported in this bug. One seems to be: How to get the right value for an autoincremented field by macro. Code with RETURNING "ID" isn't working at this moment in Base, but the following construction will help by getting the right behavior in Firebird: stSql = "SELECT RDB$GENERATOR_NAME FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME = 'Table1' AND RDB$FIELD_NAME = 'ID' AND RDB$GENERATOR_NAME IS NOT NULL" oResult = oSQL_Statement.executeQuery(stSql) WHILE oResult.next stGenerator = oResult.getString(1) WEND stSql = "SELECT GEN_ID("+stGenerator+",1) FROM RDB$DATABASE" oResult = oSQL_Statement.executeQuery(stSql) WHILE oResult.next stID = oResult.getString(1) WEND stSql = "INSERT INTO ""Table1"" (""ID"",""Date"") VALUES ("+stID+", CURRENT_DATE)" First the name of the generator for the table will be selected. Then the next generated ID of this generator will be selected and this selected value will be used for insert. So you will know the inserted ID and could use it as foreign key for other queries, updates and inserts. -- You are receiving this mail because: You are the assignee for the bug.
