Teradata SQL syntax from date to quarter I need Teradata SQL syntax to extract quarter from a date:


Date: (YYYY-MM-DD)
2015-09-12
2015-05-22
2014-12-15


Given below is the expected output:


3Q15
2Q15
4Q14


Query which I have tried (wrapped for readability):

SELECT DATE, ((CAST(EXTRACT(MONTH FROM DATE) AS BYTEINT)-1)/3)+1 
    || 'Q' || substring(DATE,3,2) quarter


Error:


  Missing parameters
Teradata supports Oracle's TO_CHAR syntax since TD14:

TO_CHAR(date, 'q"Q"yy')