使用 PutSQL returns rowid 值 sql.generated.key 属性而不是生成的序列 ID 插入 Oracle table

Insert into Oracle table using PutSQL returns rowid value for sql.generated.key attribute instead of generated sequence id

我们正在尝试使用 PutSQL 将记录插入 Oracle table,并且属性 Obtain Generated Keys 设置为 true。 NiFi DBCPConnectionPool 控制器服务配置为使用 Oracle 12c 并且 JDBC 是 ojdbc8.jar

属性 sql.generated.key 的预期值应该是数字,但得到 rowid 就像 AAJV6hAAAAAB/qFAAA

那么我们是否需要在 Oracle 端对生成的序列 ID return 而不是 rowid 进行任何配置设置?

请注意,对于 PostgreSQL,同样可以正常工作!

根据,

the Oracle JDBC driver will not return the value of the id column, but instead it will return the ROW_ID (a pseudo column that identifies a specific row), to allow you to retrieve the value yourself.

Historically the Oracle driver did it this way, because previous Oracle versions didn't have identity columns.

所以我必须添加一个处理器来从 rowid 中获取生成的序列 ID。