Its actually better to grab the sequence's next value first - then
insert with that value. That way you know that you have the right value.

In a high transaction database, grabbing the sequence's current value
after an insert could lead to the wrong value. This is for Oracle, of
course.

-- 
Alex Kac, CEO/Developer

Innovation in Personal and Business Information Management.
http://www.pocketinformant.com/ 

zoomzoom



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of JJ Smith
> Sent: Tuesday, April 30, 2002 8:33 PM
> To: Multiple recipients of list witango-talk
> Subject: Re: Witango-Talk: Identity after Insert
> 
> 
> Hi Brad/Scott,
> 
> I think Scott and I were making the same suggestion.
> This will work fine for sql-server and like Scott I
> can't speak for all databases. However I had to do the
> same thing before for Oracle and the solution is
> slightly different. Immediately after the insert do a
> DBMS with the following:
> 
> select <@literal tablename_Sequence.CURRVAL> from
> tablename;
> 
> then like before in the results:
> 
> <@assign "local$newidentityId"
> "@@local$resultSet[1,1]">
> 
> 
> This is a bit specific but may be of use to someone in
> the future who needs to do the same thing with an
> Oracle database.
> 
> JJ
> 
> --- Scott Cadillac
> <[EMAIL PROTECTED]> wrote:
> > Hi Brad,
> > 
> > Nice suggestion, but of course it could get weird
> > for this databases that
> > don't support this kind of functionality, being that
> > is usually SQL
> > specific.
> > 
> > Of course I can't speak for other Databases as I
> > mostly only use MS
> > SQL-Server. So in the meantime, if you use
> > SQL-Server, you could just use
> > another Direct_DBMS Action directly after your
> > Insert Action instead of a
> > stored procedure. And just type the following:
> > 
> > SELECT <@literal value=@><@literal value=@>IDENTITY
> > AS 'Identity'
> > 
> > Then use,
> > 
> > <@VAR local$resultSet[1,Identity]> to get the new
> > identity.
> > 
> > Hope this helps a little. Cheers...
> > 
> > Scott Cadillac
> > http://xml-extra.net
> > [EMAIL PROTECTED]
> > 
> > ----- Original Message -----
> > From: "Brad Robertson"
> > <[EMAIL PROTECTED]>
> > To: "Multiple recipients of list witango-talk" 
> > <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 30, 2002 5:37 PM
> > Subject: Witango-Talk: Identity after Insert
> > 
> > 
> > I am currently using a Direct DBMS action in wTango
> > that calls a stored
> > procedure to insert a record and then return the new
> > identity of that field,
> > it seems that works better than a insert then search
> > action to get the
> > identity field.  I was wondering if 5.0 or later
> > will have the ability to
> > grab this field on insert, or if anybody has a less
> > tedious way of doing
> > this...
> > 
> > Brad
> > 
> > 
> > 
> >
> ______________________________________________________________
> __________
> > TO UNSUBSCRIBE: send a plain text/US ASCII email to 
> > [EMAIL PROTECTED]
> >                 with unsubscribe witango-talk in the
> > message body
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness 
http://health.yahoo.com
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to