Here I will give a Teradata work around for sequence (oracle users). This is not a DDL based solution. It will generate values on the fly using query. Find the example below:-
SEL
ROW_NUMBER() OVER (PARTITION BY 'A' ORDER BY COL1) AS SEQ,
COL1,
COL2
FROM
(
SEL
COL1,
COL2
FROM MYTABLE
)TMP;
The explanation is when you partion by a constant value (in this case 'A'), full table becomes one partition. As a result row number is assigned on the basis of the ordered columns. For any doubts leave a comment.
0 comments:
Post a Comment