do $$ begin
	IF EXISTS(select * from information_schema.columns WHERE table_name='T_CDA_ONC_CONS_SUM_DETAIL' and column_name='performedtreatment')
		then
		ALTER TABLE AKUZ.T_CDA_ONC_CONS_SUM_DETAIL ALTER COLUMN "performedtreatment" TYPE text;
		UPDATE AKUZ.T_CDA_ONC_CONS_SUM_DETAIL SET "performedtreatment" = '' WHERE "performedtreatment" IS NULL;
		ALTER TABLE AKUZ.T_CDA_ONC_CONS_SUM_DETAIL ALTER COLUMN "performedtreatment" SET NOT NULL;
		END IF;
end; $$;