pull out common function
 pull out ddl