1
我正在使用JDBC + mysql。我插入一條記錄並在我的聲明中使用UUID()。我想知道,如果我們可以得到生成的UUID值從ResultSet中的?:插入後獲取UUID()的值?
PreparedStatement stmt = conn.prepareStatement("INSERT INTO foo(name, random),
VALUES(john, UUID())");
ResultSet generatedKeys = stmt.getGeneratedKeys();
// any way to find out the value of the UUID() result?
是啊,所以我只是想知道如果我能得到什麼值UUID(),而不必再次選擇上面記錄生成。
感謝
,你需要選擇 - 你可以用過'LAST_INSERTED_ID'好像它是一個自動編號列... –
無賴,ok gotcha。你可以把它作爲答案,我認爲我不能接受你的評論作爲答案。 – user291701