Not Albert, but thanks, you have give me more solutions than in the metalink
foro of oracle, thanks!! Another solution, to do only one sentence, I do´nt
want to obtain the userCode of an insert sentence that occur between the
insert and the select user_seq.curval from dual, any other solution ??

2006/9/15, Albert L. Sapp <[EMAIL PROTECTED]>:

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]


Reply via email to