1
在Postgres里,我可以写的Sybase JDBC获取生成的密钥
INSERT .. RETURNING *
要检索的插入过程中已经生成的所有值。在Oracle中,我可以使用HSQLDB
String[] columnNames = ...
PreparedStatement stmt = connection.prepareStatement(sql, columnNames);
// ...
stmt.execute();
stmt.getGeneratedKeys();
检索所有已生成的值。 MySQL是有限的,只返回设置为AUTO_INCREMENT
的列。但是,如何使用Sybase SQL Anywhere完成这项工作? JDBC驱动程序不实现这些方法,并且没有INSERT .. RETURNING
子句,如在Postgres中。有办法做到这一点,除了可能运行
SELECT @@identity
插入后立即?