Hi,
    I have a doubt about DEFAULT SERIAL, somewhere in the HowTo's
(http://www.sapdb.org/7.4/how_tos/numbergen/datentypserial_eng.htm) says
that you dont specify a value for a serial column in an INSERT statement.
Does it mean that you SHOULD NOT specify a value, or does it only mean that
if you want, you may not specify a value?

Thanks,
Gonzalo casas

> ----- Original Message ----- 
> From: "Schroeder, Alexander" <[EMAIL PROTECTED]>
> To: "'Marc-Olivier Meunier'" <[EMAIL PROTECTED]>; "'Sapdb. General'"
> <[EMAIL PROTECTED]>
> Sent: Thursday, July 10, 2003 7:52 AM
> Subject: RE: How to get the id of the last inserted row ?
>
>
> > Hello Marc-Olivier,
> >
> > that SELECT will not work because of
> >
> > a) the ORDER BY is applied *after* the ROWNUM < 2 predicate
> >
> > b) depending on the isolation level, auto commit flag etc., you may find
> >    values inserted by some other session.
> >
> > You might instead do a
> >
> > SELECT table_name.CURRVAL from DUAL
> >
> > to get the last assigned value of the serial column in the
> > table_name table in the current database session.
> >
> > Alexander Schr�der
> > SAP DB, SAP Labs Berlin
> >
> > > -----Original Message-----
> > > From: Marc-Olivier Meunier [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, July 10, 2003 11:47 AM
> > > To: 'Sapdb. General'
> > > Subject: How to get the id of the last inserted row ?
> > >
> > >
> > > Hi all
> > >
> > > I'm looking for a way to get the id of the last inserted row
> > > in a table
> > > In fact, i would like to know if there is something with sessions when
> > > inserting a row.
> > > For example : i insert a row in a table which contains a SERIAL(1)
> > > default value for the id.
> > > If the next instruction is SELECT * FROM mytable WHERE rowno < 2 ORDER
> > > BY id DESC
> > > Will i get my last inserted row or not ? Considering that my db is
> > > linked to a web server with dozens query at the same time.
> > >
> > > Is there any other trick if this doesn't work ?
> > > Is a dbproc executed in a row or is it possible that two dbproc are
> > > executed at the same time ?
> > >
> > > Thanx
> > >
> > > --
> > > Marc-Olivier Meunier
> > > Ing�nieur Projet BKLINK
> > > MVH-IRIS
> > > 14, rue Rougemont
> > > 75009 Paris
> > >
> > > _______________________________________________
> > > sapdb.general mailing list
> > > [EMAIL PROTECTED]
> > > http://listserv.sap.com/mailman/listinfo/sapdb.general
> > >
> > _______________________________________________
> > sapdb.general mailing list
> > [EMAIL PROTECTED]
> > http://listserv.sap.com/mailman/listinfo/sapdb.general
>

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to