struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Chacón Sánchez" <danielc...@gmail.com>
Subject Re: Out of topic, Oracle SEQUENCE
Date Fri, 15 Sep 2006 17:06:30 GMT
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 <asapp@uiuc.edu>:
>
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message