oracle - SQL hierarchical table need to be simplified -
i'm having little trouble on making table bit more simple, let me explain:
table structure input:
old_key | new key   4536     4566   4566     4977   4321     10290   5423     8920 i'm getting data source, changing retro pk(serial number) in few tables; , after that, need update table new serial number.
my problem is, instead of simple update, data can come in example, , change twice or more same old key like(in example) 4536 first changes 4566 , changes again 4977.
this forcing me use cursor, update each table row row ordered first key , etc...
it used fine, lately, data amount multiplied self lot , making process heavy , taking lot of resources.
my question is: need eliminate keys have updated twice or more, once, meaning - out put above example:
old_key | new_key   4536     4977   4321     10290   5423     8920 thought using hierarchical functions prior , start with.. start with?
thanks in advance.
select connect_by_root( old_key ) old_key,        new_key   table_name  connect_by_isleaf = 1 start old_key not in ( select new_key table_name ) connect prior new_key = old_key; 
Comments
Post a Comment