Daniel,
If you are by chance using iBatis, look at their selectKey command. It
is the one that seems to be referred to most for this type of need on
the iBatis list. If not, sorry.
Al
Brett Connor wrote:
(In case my reply to completely the wrong post didn't get read!...)
selecting max... isn't a viable solution, because of other sessions as you say.
Assuming you're at least using Java, you might want to look at
java.sql.Statement.getGeneratedKeys()
Oracle database returns generated keys in the 'C' i/f, my memory's rusty for
JDBC but I know there is a way somewhere to get the key values in the same
statement, rather than have to execute another statement for 'curval'.
getGeneratedKeys() may be it.
HTH
Brett
Quoting Daniel Chacón Sánchez <[EMAIL PROTECTED]>:
Thanks
so, first:
insert into users_values (user_seq .nextval, 'userName');
and then:
select user_seq.curval from dual
There is not a way to make only one sentence to do that? Like in SQL 2000:
SET NOCOUNT ON INSERT INTO
USER_VALUES
(USER_NAME)
VALUES ('DANIEL')
*SELECT @@IDENTITY* as userCode SET NOCOUNT OFF
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]