DROP PROCEDURE IF EXISTS redate_order;
delimiter //
CREATE PROCEDURE redate_order (INOUT orderid INT, INOUT stamp VARCHAR(255))
proc:BEGIN
   START TRANSACTION;
   update wp_wpsg_order set cdate=stamp where id=orderid;
   insert into wp_wpsg_orderlog set o_id=orderid,cdate=now(),title="dummy";
   SET @neworder=LAST_INSERT_ID();
   update wp_wpsg_orderlog set title=concat("Datum manuell geändert auf ",stamp) where id=@neworder;
   SET stamp=(select title from wp_wpsg_orderlog where id=@neworder);
   COMMIT;
END
//
delimiter ;

