DELIMITER $$ DROP PROCEDURE IF EXISTS `inserted`$$ CREATE PROCEDURE `inserted` ( INOUT thedate DATETIME, INOUT theuser VARCHAR(10)) BEGIN SET thedate = ifnull(thedate, now()); /*Sets the user to a first letter capped for the actual mysql username without the domain info.*/ SET theuser = CONCAT( UPPER( SUBSTR( USER(), 1, 1 ) ) , LOWER( SUBSTRING( SUBSTR(USER(),1,INSTR(USER( ),'@')-1), 2 ) ) ); END$$ DELIMITER ;