struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert L. Sapp" <as...@uiuc.edu>
Subject Re: Out of topic, Oracle SEQUENCE
Date Fri, 15 Sep 2006 16:53:49 GMT
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 <danielccss@gmail.com>:
>
>   
>> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message