declare
	
	cursor c1 is
		select object_name, object_type from all_objects
	   	where object_type in ('TABLE','SEQUENCE','PACKAGE') and owner = 'TRESIMMO' and status = 'VALID'
			order by object_type desc;
	n PLS_INTEGER;

begin
        n := dbms_sql.open_cursor;
	for c1rec in c1 loop
		begin
			dbms_sql.parse(n, 'drop synonym ' || c1rec.object_name, dbms_sql.native);
		exception when others then null; end;
		begin
		   dbms_sql.parse(n, 'create synonym ' || c1rec.object_name || ' for TRESIMMO.' || c1rec.object_name, dbms_sql.native);
		exception when others then null; end;
   end loop;
	dbms_sql.close_cursor (n);
end;
/
exit
/