I want to remove duplicate rows in a table but I don't want to create a new table.
I have create a stored procedure for this, but it is not returning the current result, and this stored procedure will create a temp table, it will be dropped though.
create procedure test_procedure()
language plpgsql
as $$
DECLARE
_temp_table character varying(20) := 'TempTable';
BEGIN
SELECT * INTO _temp_table FROM A group by col1,col2; -- this will remove duplicate rows, as A only has 2 cols
delete from A;
insert into A select * from _temp_table ;
drop table _temp_table ;
end; $$