Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / April 2006

Tip: Looking for answers? Try searching our database.

Sequences in db2 8.1.0.36.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ayusman - 03 Apr 2006 07:52 GMT
Hi All,
I am using IBM db2 version: 8.1.0.36.

The following code:

insert into t values (next value for s)
[
WHERE t is a table with single column of integer type.
s is a sequence I creates, which shows in the sysibm.syssequences.
]
gives me error saying "for" is an unidentified token.

When I run the same query in db2 8.1.7 it runs well.

Can any one please say what is the problem?
How can I use Sequence in db2???

Thanks and regards.
Ayusma

--
Ayusma
Peri - 03 Apr 2006 10:27 GMT
Ayusman ,
Seems like u have encountered minor syntactical error

> insert into t values (next value for s)
> [
> WHERE t is a table with single column of integer type.
> s is a sequence I creates, which shows in the sysibm.syssequences.
> ]
It should have been
insert into t values (NEXTVAL for s)
Much of the information can be found at
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.
udb.doc/ad/c0007007.htm


> gives me error saying "for" is an unidentified token.
>
[quoted text clipped - 11 lines]
> Ayusman's Profile: http://www.dbtalk.net/m98
> View this thread: http://www.dbtalk.net/t296807
Serge Rielau - 03 Apr 2006 21:36 GMT
> Ayusman ,
> Seems like u have encountered minor syntactical error
[quoted text clipped - 8 lines]
> Much of the information can be found at
> http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.
udb.doc/ad/c0007007.htm
Note that NEXT VALUE FOR <seqname> is the SQL Standard syntax.
NEXTVAL was the syntax chosen by DB2 prior to sequences being added to
the SQL Standard.
So, moving forward please use NEXT VALUE FOR and PREVIOUS VALUE FOR for
compliance. NETXVAL and PREVVAL remain of course supported for backward
compatibility.

Cheers
Serge
Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

Ayusman - 05 Apr 2006 08:21 GMT
Thanks a lot.
I was facing this proble.
But why does it work in db2 8.1.7?

--
Ayusma
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.