Struggling with duplicates
Continuing theme use dynamic SQL, I want to tell you about one useful tool implemented by me in one of the current projects. It will be about the duplicates in the directories. Under duplicates, in this article, I understand entries made in the directories repeatedly, for example as a result spelling errors when entering names. The essence of the proposed approach is to give the opportunity to declare any entry of the directory is a duplicate of an existing one. As a result, the duplicate record will be deleted, and all references to it are fixed so that they began to refer to the correct entry. Also, it is very important to provide the opportunity to revert such changes if they are made by mistake. Let's start with the tables to store technical data: Service table create table mg_table ( table_name varchar(100) not null, pk_name varchar(100) not null, primary key(table_name) ); create sequence mg_action_seq; create table mg_action ( id bigint default nextval(