Link to home
Start Free TrialLog in
Avatar of hj
hj

asked on

sequence number in db2

How can I create a sequence number like x=x+1 directly in select statement in db2.
Sample SELECT x=x+1 || oid FROM tablename.
Avatar of hitachi
hitachi

Hi
   Can you please elaborate more on what you want.
I guess if you want the sequence functionality then
there is facility of auto genration of numbers in db2.
For that you have to crate a table with a field which is
populated by db2 itself. You can find detail about on db2
manuals.
          If you want row number like functionality then
you can use ROW_NUMBER() function.




Hitachi
Avatar of hj

ASKER

I'm trying to create a view on existing tables. All these tables contains a column OID (because the application above is object oriented). I wanna combine all the OID's in one column in the view and exactly for this I need an additional sequence number.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts refunded
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
ASKER CERTIFIED SOLUTION
Avatar of Jgould
Jgould

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial