Fork me on GitHub

we have a procedure that ends with select @@IDENTITY. however, when using! or to run the procedure, I only get back the update-count. is it possible to get the result of select @@IDENTITY?


@saikyun Per the next.jdbc *Getting Started* page: "If you pass the :multi-rs true option to execute!, you will get back a vector of results sets, instead of just one result set: a vector of zero or more vectors. The result may well be a mix of vectors containing realized rows and vectors containing update counts, reflecting the results from specific SQL operations in the stored procedure or script."


I think I tried that option, but I don't remember exactly how I did it. I'll give it another shot and come back if I have more questions 🙂


thanks for the reply


It will depend on your DB/driver -- what are you using?


microsoft sql server


OK, I've tested multiple result sets on SQL Server and it works (this is from the test suite):

(jdbc/execute! (ds)
                           [(str "begin"
                                 " select * from fruit;"
                                 " select * from fruit where id < 4;"
                                 " end")


That produces a vector containing two result sets, i.e., two vectors of hash maps, and the first result set contains four rows and the second result set contains three rows.


(it's also described on the All The Options page and in the docstring itself for execute!)