update MENU_LINE ml
set    ml.STOCK_NAME = ml.STOCK_NAME ||
                       (select coalesce(list (cast('*' as varchar(10)), ''), '')
                        from   MENU_LINE l
                        where  l.ID_MENU_HEAD = ml.ID_MENU_HEAD
                               and l.ID_MENU_GROUP = ml.ID_MENU_GROUP
                               and l.ID_STOCK = ml.ID_STOCK
                               and l.STOCK_NAME = ml.STOCK_NAME
                               and l.ID_MENU_LINE > ml.ID_MENU_LINE)
where exists (select l.ID_MENU_LINE
                        from   MENU_LINE l
                        where  l.ID_MENU_HEAD = ml.ID_MENU_HEAD
                               and l.ID_MENU_GROUP = ml.ID_MENU_GROUP
                               and l.ID_STOCK = ml.ID_STOCK
                               and l.STOCK_NAME = ml.STOCK_NAME
                               and l.ID_MENU_LINE > ml.ID_MENU_LINE)
order by ml.ID_MENU_LINE asc;

delete
from   MENU_LINE_PRICE mlp
where  exists (select *
               from   MENU_LINE_PRICE lp
               where  lp.ID_MENU_LINE = mlp.ID_MENU_LINE
                      and lp.ID_MENU_PRICE_LIST = mlp.ID_MENU_PRICE_LIST
                      and lp.ID_MENU_LINE_PRICE < mlp.ID_MENU_LINE_PRICE);


