max sequence value --- how?
Question posted by: aj
(Guest)
on
July 22nd, 2008 08:25 PM
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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
|
|
July 22nd, 2008 11:25 PM
# 2
|
Re: max sequence value --- how?
On Jul 22, 1:19 pm, aj <ron...@mcdonalds.comwrote:
Quote:
Originally Posted by
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_SCHEMA.YOUR_SEQ_NAME>;
--Jeff
|
|
July 23rd, 2008 12:15 PM
# 3
|
Re: max sequence value --- how?
aj wrote:
Quote:
Originally Posted by
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.SEQUENCES.NEXTCACHFIRSTVALUE
If you don't have it on your version look in SYSIBM.SEQUENCES
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
|
|
July 23rd, 2008 03:15 PM
# 4
|
Re: max sequence value --- how?
Serge: thx for reply.
There is no SYSCAT.SEQUENCES.NEXTCACHFIRSTVALUE,
and SYSIBM.SEQUENCES does not exist....???
Any other ideas?
aj
Serge Rielau wrote:
Quote:
Originally Posted by
aj wrote:
Quote:
Originally Posted by
>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.SEQUENCES.NEXTCACHFIRSTVALUE
If you don't have it on your version look in SYSIBM.SEQUENCES
>
Cheers
Serge
>
>
|
|
|
July 23rd, 2008 06:05 PM
# 5
|
Re: max sequence value --- how?
On Jul 23, 8:09*am, aj <ron...@mcdonalds.comwrote:
Quote:
Originally Posted by
Serge: *thx for reply.
>
There is no SYSCAT.SEQUENCES.NEXTCACHFIRSTVALUE,
and SYSIBM.SEQUENCES does not exist....???
>
Any other ideas?
aj
>
>
>
Serge Rielau wrote:
Quote:
Originally Posted by
aj wrote:
Quote:
Originally Posted by
DB2 LUW 8.1 fixpak 14
Linux Red Hat AS
|
|
>
Quote:
Originally Posted by
Quote:
Originally Posted by
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;
|
|
>
Quote:
Originally Posted by
Quote:
Originally Posted by
Is there some way for the system catalogs or some trick to get me the
maximum value of the sequence?
|
|
>
Quote:
Originally Posted by
Quote:
Originally Posted by
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.
|
|
>
>
Quote:
Originally Posted by
SYSCAT.SEQUENCES.NEXTCACHFIRSTVALUE
If you don't have it on your version look in SYSIBM.SEQUENCES
|
>
Quote:
Originally Posted by
Cheers
Serge- Hide quoted text -
|
>
- Show quoted text -
|
Try SYSIBM.SYSSEQUENCES
/T
|
|
July 23rd, 2008 07:55 PM
# 6
|
Re: max sequence value --- how?
This is just what I needed. Thanks Tomas.
Tomas wrote:
Quote:
Originally Posted by
On Jul 23, 8:09 am, aj <ron...@mcdonalds.comwrote:
Quote:
Originally Posted by
>Serge: thx for reply.
>>
>There is no SYSCAT.SEQUENCES.NEXTCACHFIRSTVALUE,
>and SYSIBM.SEQUENCES does not exist....???
>>
>Any other ideas?
>aj
>>
>>
>>
>Serge Rielau wrote:
Quote:
Originally Posted by
>>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.SEQUENCES.NEXTCACHFIRSTVALUE
>>If you don't have it on your version look in SYSIBM.SEQUENCES
>>Cheers
>>Serge- Hide quoted text -
|
>- Show quoted text -
|
>
Try SYSIBM.SYSSEQUENCES
>
/T
|
|
|
July 23rd, 2008 08:55 PM
# 7
|
Re: max sequence value --- how?
Sorry.. sleep deprived.
Have been standing on the Newark runway half of last night :-(
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
|
|
July 24th, 2008 01:35 PM
# 8
|
Re: max sequence value --- how?
No problem Serge - I appreciate all the help you provide. :)
Long layovers are no fun...
Serge Rielau wrote:
Quote:
Originally Posted by
Sorry.. sleep deprived.
Have been standing on the Newark runway half of last night :-(
>
Cheers
Serge
>
|
Not the answer you were looking for? Post your question . . .
183,965 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Latest Articles: Read & Comment
Top Community Contributors
|