|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/29/2008 10:29:00 PM
Posts: 1,
Visits: 9
|
|
Hi Vikas,
Yours->If u need sequence solution then u need to create a seperate table : sequence and write trigger (after insert on the table for which u wish to implement it and within this proc u need to implement the logic ). I have done it and if u want i can send u the code as well .
->Could you please help me to send your code to generate unique id to ....vs1000@rediffmail.com
subbu
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: Today @ 7:30:07 AM
Posts: 197,
Visits: 611
|
|
Hello,
Yes, there is no direct/1-to-1 equivalent in Teradata for Oracle sequencers.
What you can do, is to write a simple trigger as follows:
Suppose we have table definition as follows:
CREATE TABLE Table1 (Sequence1 Integer, Col1 Integer, Col2 Integer);
And a temporary table as follows:
CREATE VOLATILE TABLE tempTable1 (CurrentMaxValue Integer) ON COMMIT PRESERVE ROWS;
And we have an INSERT TRIGGER on this table as follows:
- INSERT tempTable1 (CurrentMaxValue) SELECT Max(Sequence1) + 1 FROM Table1;
- UPDATE Table1 SET Sequence1 = tempTable1.CurrentMaxValue WHERE (add parameters from newly added row);
- Empty the temporary table tempTable1.
I haven't tried it, but it should work if it doesn't hit any INSERT trigger's limitation. HTH.
Regards,
Adeel
|
|
|
|