Hello Peter, The definition of CURRVAL is:
<table_name>.CURRVAL Last assigned value of the serial column in the table_name table in the current database session. So if there wasn't yet an insert into the table in this session, there is no CURRVAL. There is, by the way, no such thing like <table_name>.NEXTVAL. Regards Alexander Schr�der SAP DB, SAP Labs Berlin > -----Original Message----- > From: "H�bschen, Peter" [mailto:[EMAIL PROTECTED] > Sent: Friday, September 05, 2003 11:51 AM > To: [EMAIL PROTECTED] > Subject: id of the lastly inserted record > > > Hello, > > I've tried what is described in this howto below (SAPDB > 7.4.03.25). But for > me it doesn't work or do I have a misunderstanding. > I have some tables where I have a line like this: > i.e. definition of table Test1: > <snip> > "<column name>" Integer NOT NULL DEFAULT > SERIAL (1) > </snip> > The number generator works. But if I do a "Select > Test1.Currval from test1" > I get error -2029 ("Currval is not yet defined."). So I made a "Select > Test1.Nextval from test", then I get error -4020 ("Unknown > sequence name"). > So I don't get the current value back. > > Maybe it has something to do with my definition? > > Thanks in advance > Peter > > > > > -----Urspr�ngliche Nachricht----- > > Von: Zabach, Elke [SMTP:[EMAIL PROTECTED] > > Gesendet am: Freitag, 5. September 2003 08:46 > > An: 'Stephan Stapel'; [EMAIL PROTECTED] > > Betreff: RE: id of the lastly inserted record > > > > > > > > Stephan Stapel wrote: > > > > > > Dear list, > > > > > > though it was already asked before several times, there > was never a > > > satisfying answer to this. > > > > The answer given in here > > http://www.sapdb.org/7.4/how_tos/numbergen/datentypserial_eng.htm > > and in so many mails of this list is not satisfying? What > do you expect? > > > > Elke > > SAP Labs Berlin > > > > > Is it possible and if so, how, to retrieve the id of an > > > record that was > > > inserted. This should however for sure only be possible in > > > case of using > > > "technical keys", i.e. with an (unsigned) integer as the pk > > > and also only be > > > necessary in case of using SERIAL(n). > > > If there is no possibility or at least work-around, using > > > SERIAL(n) for a pk > > > should make no sense it all, does it? > > > > > > Thanks for your help in advance! > > > > > > Kind regards, > > > > > > Stephan > > > > > > -- > > > COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test > > > -------------------------------------------------- > > > 1. GMX TopMail - Platz 1 und Testsieger! > > > 2. GMX ProMail - Platz 2 und Preis-Qualit�tssieger! > > > 3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. > > > daybyday - 8. e-Post > > > > > > _______________________________________________ > > > 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 > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
