Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Create new table from old table with .....
All,
Can anybody help me finding a SQL or PL/SQL to solve the following problem.
I have a table which contains priority changes and timestamp of this priority changes for a specific req_id :
Description
unix_timestamp req_id557544
------------------------------------------------------- -
--------------------- ------------------- FIELD='priority' OLD='2' NEW='1' 924248880 557544 FIELD='priority' OLD='1' NEW='2' 924769137 557544 FIELD='priority' OLD='2' NEW='1' 924777987
FIELD='priority' OLD='1' NEW='2' 925822510 661106 FIELD='priority' OLD='2' NEW='3' 925824067661106
From this table I like to create the following table in which a new column next_timestamp is added. This column should contain the value of the next unix_timestamp for a specific req_id.
Description
unix_timestamp next_timestamp req_id
------------------------------------------------------- -
--------------------- ---------------------- ------------------- FIELD='priority' OLD='2' NEW='1' 924248880 924769137 557544 FIELD='priority' OLD='1' NEW='2' 924769137 924777987 557544 FIELD='priority' OLD='2' NEW='1' 924777987 - 557544 Description unix_timestamp next_timestamp req_id
------------------------------------------------------- -
--------------------- ---------------------- ------------------- FIELD='priority' OLD='1' NEW='2' 925822510 925824067 661106 FIELD='priority' OLD='2' NEW='3' 925824067 - 661106
Any suggestions
Thanks
Stefan Received on Sun Jun 20 1999 - 11:06:05 CDT