WITH 'number: 1' as year SELECT extract(year, '\\d+'); WITH 'number: 2' as mm SELECT extract(mm, '\\d+'); WITH 'number: 3' as s SELECT extract(s, '\\d+');