473,763 Members | 7,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

max sequence value --- how?

aj
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS

I'm trying to get the maximum value of a sequence. Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;

Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?

Note that I'm on DB2 LUW 8.1 fixpak 14. There's apparently some
sequence highwater column in v9, but I don't think I have it.

tia

aj
Jul 22 '08 #1
7 8943
On Jul 22, 1:19 pm, aj <ron...@mcdonal ds.comwrote:
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS

I'm trying to get the maximum value of a sequence. Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;

Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?

Note that I'm on DB2 LUW 8.1 fixpak 14. There's apparently some
sequence highwater column in v9, but I don't think I have it.

tia

aj
You can see the next value (that would have been assigned), which is
presumably one more than the present "maximum value" by running the
following:

VALUES NEXTVAL FOR <YOUR_SEQ_SCHEM A.YOUR_SEQ_NAME >;

--Jeff
Jul 22 '08 #2
aj wrote:
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS

I'm trying to get the maximum value of a sequence. Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;

Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?

Note that I'm on DB2 LUW 8.1 fixpak 14. There's apparently some
sequence highwater column in v9, but I don't think I have it.

tia

aj
SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE
If you don't have it on your version look in SYSIBM.SEQUENCE S

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jul 23 '08 #3
aj
Serge: thx for reply.

There is no SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE,
and SYSIBM.SEQUENCE S does not exist....???

Any other ideas?
aj
Serge Rielau wrote:
aj wrote:
>DB2 LUW 8.1 fixpak 14
Linux Red Hat AS

I'm trying to get the maximum value of a sequence. Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;

Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?

Note that I'm on DB2 LUW 8.1 fixpak 14. There's apparently some
sequence highwater column in v9, but I don't think I have it.

tia

aj
SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE
If you don't have it on your version look in SYSIBM.SEQUENCE S

Cheers
Serge

Jul 23 '08 #4
On Jul 23, 8:09*am, aj <ron...@mcdonal ds.comwrote:
Serge: *thx for reply.

There is no SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE,
and SYSIBM.SEQUENCE S does not exist....???

Any other ideas?
aj

Serge Rielau wrote:
aj wrote:
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS
I'm trying to get the maximum value of a sequence. *Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;
Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?
Note that I'm on DB2 LUW 8.1 fixpak 14. *There's apparently some
sequence highwater column in v9, but I don't think I have it.
tia
aj
SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE
If you don't have it on your version look in SYSIBM.SEQUENCE S
Cheers
Serge- Hide quoted text -

- Show quoted text -
Try SYSIBM.SYSSEQUE NCES

/T
Jul 23 '08 #5
aj
This is just what I needed. Thanks Tomas.

Tomas wrote:
On Jul 23, 8:09 am, aj <ron...@mcdonal ds.comwrote:
>Serge: thx for reply.

There is no SYSCAT.SEQUENCE S.NEXTCACHFIRST VALUE,
and SYSIBM.SEQUENCE S does not exist....???

Any other ideas?
aj

Serge Rielau wrote:
>>aj wrote:
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS
I'm trying to get the maximum value of a sequence. Because of the way
the sequence is used (on several tables comprising a fat view), its too
expensive to do the usual
select max(<col>) from <view;
Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?
Note that I'm on DB2 LUW 8.1 fixpak 14. There's apparently some
sequence highwater column in v9, but I don't think I have it.
tia
aj
SYSCAT.SEQUEN CES.NEXTCACHFIR STVALUE
If you don't have it on your version look in SYSIBM.SEQUENCE S
Cheers
Serge- Hide quoted text -
- Show quoted text -

Try SYSIBM.SYSSEQUE NCES

/T
Jul 23 '08 #6
Sorry.. sleep deprived.
Have been standing on the Newark runway half of last night :-(

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jul 23 '08 #7
aj
No problem Serge - I appreciate all the help you provide. :)
Long layovers are no fun...

Serge Rielau wrote:
Sorry.. sleep deprived.
Have been standing on the Newark runway half of last night :-(

Cheers
Serge
Jul 24 '08 #8

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

Similar topics

5
36776
by: Ken1 | last post by:
I am going to drop a primary key from one column and create a new column to be used as primary key in an existing database. The old column was a date column which someone earlier though was a good candidate for a primary key which we all know it's not. Now I want to add a new field, i.e. called ID, with a normal number sequence as primary key. I have dropped the primary key, created the new column, created the new sequence and created...
10
2632
by: Anthony Best | last post by:
I'm working on an idea that uses sequences. I'm going to create a table like this: id serial, sequence int, keyword varchar(32), text text for every keyword there will be a uniq sequence for it eg:
4
8216
by: j | last post by:
In a footnote in the c99 standard the following is labeled as undefined: a = i; And in the second clause of section 6.5 the following is stated: "Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value
53
4089
by: Deniz Bahar | last post by:
I know the basic definition of a sequence point (point where all side effects guaranteed to be finished), but I am confused about this statement: "Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored." Can someone give me examples of expressions that "barely"...
7
2080
by: akarl | last post by:
Hi all, Why do I get a warning from gcc with the following program? $ cat test.c #include <stdio.h> int f(int n) { return n;
1
2211
by: Marek Lewczuk | last post by:
Hello, I would like to ask if my problem with sequence is a proper behavior or this is a bug (probably not)... I have a table: CREATE TABLE "testtable" ( "serialfield" SERIAL, "someotherfield" TEXT, PRIMARY KEY("serialfield")
9
2510
by: John Smith | last post by:
I've been playing with splint, which returns the following warning for the code below: statlib.c: (in function log_norm_pdf) statlib.c(1054,31): Expression has undefined behavior (left operand uses errno, modified by right operand): (log(x) - mu) * (log(x) - mu) Code has unspecified behavior. Order of evaluation of function parameters or subexpressions is not defined, so if a value is used and
1
3029
davydany
by: davydany | last post by:
Hey guys...a n00b Here for this site. I'm making a sequence class for my C++ class. And The thing is in the array that I have, lets say i put in {13,17,38,18}, when i see the current values for the array data from 0 to3, I get this {13, JUNK VALUE, 17,38, 18} and JUNK VALUE is like 1.8e831 or something like that. This happens when I use the attach() function and use the current() function to display the values at data I really want to...
7
17375
by: Rahul B | last post by:
Hi, If i do a "Select nextval for <seq_namefrom sysibm.sysdummy1", it increases the values of nextval by1. How can i find out the nextval of a sequence without actually increasing the value. The statement "Select prevval for <seq_namefrom sysibm.sysdummy1" gives the value of previous correctly generated value only if the
5
1820
by: =?ISO-8859-1?Q?Marcel_M=FCller?= | last post by:
Hi, I have a question about the execution sequence of the postfix increment operator with respect to a function call. void foo(int type, int*& data); int* sequence;
0
9564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.