select if (EXECUTION_PERIOD.KEY_PREVIOUS_EXECUTION_PERIOD is not null, concat('update EXECUTION_PERIOD set EXECUTION_PERIOD.KEY_NEXT_EXECUTION_PERIOD = ',
	EXECUTION_PERIOD.ID_INTERNAL, 
	' where EXECUTION_PERIOD.ID_INTERNAL = ', 
	EXECUTION_PERIOD.KEY_PREVIOUS_EXECUTION_PERIOD, ';'), "") 
as "" from EXECUTION_PERIOD;