- 
- All Superinterfaces:
- Attachable,- AutoCloseable,- Flow.Publisher<Integer>,- Insert<R>,- org.reactivestreams.Publisher<Integer>,- Query,- QueryPart,- RowCountQuery,- Serializable,- Statement
 
 public interface InsertResultStep<R extends Record> extends Insert<R> This type is used for theInsert's DSL API.Example: DSLContext create = DSL.using(configuration); TableRecord<?> record = create.insertInto(table, field1, field2) .values(value1, value2) .returning(field1) .fetchOne();This implemented differently for every dialect: - DB2 allows to execute
 SELECT .. FROM FINAL TABLE (INSERT ...)
- HSQLDB, and Oracle JDBC drivers allow for retrieving any table column as "generated key" in one statement
- Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY column values as "generated key". If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
- Sybase and SQLite allow for retrieving IDENTITY values as
 @@identityorlast_inserted_rowid()values. Those values are fetched in a separateSELECTstatement. If other fields are requested, another statement is issued. Client code must assure transactional integrity between these statements.
 ReferencingXYZ*Steptypes directly from client codeIt is usually not recommended to reference any XYZ*Steptypes directly from client code, or assign them to local variables. When writing dynamic SQL, creating a statement's components dynamically, and passing them to the DSL API statically is usually a better choice. See the manual's section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql.Drawbacks of referencing the XYZ*Steptypes directly:- They're operating on mutable implementations (as of jOOQ 3.x)
- They're less composable and not easy to get right when dynamic SQL gets complex
- They're less readable
- They might have binary incompatible changes between minor releases
 - Author:
- Lukas Eder
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Result<R>fetch()The result holding returned values as specified by theInsertReturningStep.RfetchOne()The record holding returned values as specified by theInsertReturningStep.@NotNull Optional<R>fetchOptional()The record holding returned values as specified by theInsertReturningStep.- 
Methods inherited from interface org.jooq.Attachableattach, configuration, detach
 - 
Methods inherited from interface java.util.concurrent.Flow.Publishersubscribe
 - 
Methods inherited from interface org.jooq.Querybind, bind, cancel, close, execute, executeAsync, executeAsync, getBindValues, getParam, getParams, getSQL, getSQL, getSQL, isExecutable, keepStatement, poolable, queryTimeout
 
- 
 
- 
- 
- 
Method Detail- 
fetch@NotNull @Support @NotNull Result<R> fetch() throws DataAccessException The result holding returned values as specified by theInsertReturningStep.- Returns:
- The returned values as specified by the
         InsertReturningStep. Note:- Not all databases / JDBC drivers support returning several values on multi-row inserts!
- This may return an empty
         Resultin case jOOQ could not retrieve any generated keys from the JDBC driver.
 
- Throws:
- DataAccessException- if something went wrong executing the query
- See Also:
- InsertQuery.getReturnedRecords()
 
 - 
fetchOne@Nullable @Support R fetchOne() throws DataAccessException, TooManyRowsException The record holding returned values as specified by theInsertReturningStep.- Returns:
- The returned value as specified by the
         InsertReturningStep. This may returnnullin case jOOQ could not retrieve any generated keys from the JDBC driver.
- Throws:
- DataAccessException- if something went wrong executing the query
- TooManyRowsException- if the query returned more than one record
- See Also:
- InsertQuery.getReturnedRecord()
 
 - 
fetchOptional@NotNull @Support @NotNull Optional<R> fetchOptional() throws DataAccessException, TooManyRowsException The record holding returned values as specified by theInsertReturningStep.- Returns:
- The returned value as specified by the
         InsertReturningStep
- Throws:
- DataAccessException- if something went wrong executing the query
- TooManyRowsException- if the query returned more than one record
- See Also:
- InsertQuery.getReturnedRecord()
 
 
- 
 
-