View previous topic :: View next topic
|
Author |
Message |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi,
I have two tables T1 & T2 with columns T1_SEQ(integer) and T2_SEQ(integer) respectively
I need a cursor which will give all the numeric values which is not present in T1 and T2.
Code: |
T1_SEQ T2_SEQ
------ ------
1 4
2 6
3 9
|
Code: |
Cursor Output
-------------
5
7
8
|
I have some alternatives. But I want to know whether it is possible or not.
Thanks,
Arun |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
It is not possible. The result set you describe has an infinite number (well up to the largest number an integer type can be) of rows in it. The values an integer can store range from -2,147,483,648 to +2,147,483,647. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi Steve,
I m sorry for not making it clear. I need only the values till MAX(T2_SEQ).
we are using db2 v7
Thanks,
Arun |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
?? you want a result set based on rows that are not there? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
It could be done for the seq that is in one table but not the other but I'm not sure about a number missing from both tables. It may be possible but the expense may be high. |
|
Back to top |
|
|
rashmi.ranjan75
New User
Joined: 20 Feb 2006 Posts: 34
|
|
|
|
after looking into the example given by you it seems that you want to fetch all the numbers which are
- less than the max number in T2
- not present in any of the tables T1 or T2
correct me if i am wrong...becz requirement is not very clear.. |
|
Back to top |
|
|
|