473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Sequences in db2 8.1.0.36.


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.
Ayusman
--
Ayusman
------------------------------------------------------------------------
Ayusman's Profile: http://www.dbtalk.net/m98
View this thread: http://www.dbtalk.net/t296807

Apr 3 '06 #1
3 2227
Ayusman ,
Seems like u have encountered minor syntactical error
Ayusman wrote:
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/infoce...d/c0007007.htm
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.
Ayusman
--
Ayusman
------------------------------------------------------------------------
Ayusman's Profile: http://www.dbtalk.net/m98
View this thread: http://www.dbtalk.net/t296807


Apr 3 '06 #2
Peri wrote:
Ayusman ,
Seems like u have encountered minor syntactical error
Ayusman wrote:
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/infoce...d/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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Apr 3 '06 #3

Thanks a lot.
I was facing this proble.
But why does it work in db2 8.1.7??
--
Ayusman
------------------------------------------------------------------------
Ayusman's Profile: http://www.dbtalk.net/m98
View this thread: http://www.dbtalk.net/t296807

Apr 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: temp | last post by:
Hi All, I wonder could someone help me with this? What I want to do is search through a list of letters and look for adjacent groups of letters that form sequences, not in the usual way of...
10
by: Vilson farias | last post by:
Greetings, I'm getting a big performance problem and I would like to ask you what would be the reason, but first I need to explain how it happens. Let's suppose I can't use sequences (it seams...
1
by: CSN | last post by:
I'm getting these errors when importing dumps: ERROR: relation "table1_id_seq" does not exist ERROR: relation "table2_id_seq" does not exist I renamed a couple tables, and the names of their...
4
by: Hemant Shah | last post by:
Folks, I have created bunch of sequences in DB2 7.2. How do I list all the defined sequences and if possible their current values? Thanks. --
1
by: J.Haan | last post by:
Hey all, does anyone know if it is in any way harmful to use a lot of sequences in a database? Does it have any disadvantages? I already noticed that sequences are hard to use with...
2
by: Peteris Krumins | last post by:
Hello, while reading through iso c standard (August 3, 1998), I noticed something I had never heard of in C: "Trigraph sequences", 5.2.1.1 The standard says: "All occurrences in a source file...
3
by: Ken | last post by:
HI: I'm reading a string that will be displayed in a MessageBox from a resource file. The string in the resource file contains escape sequences so they will be broken up into multiple lines. ...
18
by: Bruno Baguette | last post by:
Hello, I have to design a table wich will store some action reports. Each report have an ID like this 1/2004, 2/2004, ... and each years, they restart to 1 (1/2004, 1/2005, 1/2006,...). So, I...
5
by: Michael Fuhr | last post by:
I'd like to propose that certain GRANTs on a table cascade to the table's implicit sequences. In the current implementation (as of 7.4.5 and 8.0.0beta3), a table owner must typically issue GRANT...
4
by: JJ | last post by:
Is there a way of checking that a line with escape sequences in it, has no strings in it (apart from the escape sequences)? i.e. a line with \n\t\t\t\t\t\t\t\r\n would have no string in it a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.