Fix sql function declaration