DB2 z/OS - 获取年份的最后 2 位数字

DB2 z/OS - Get the last 2 digits of year

SELECT
     SUBSTR(CAST(YEAR(SOMEDATE) AS VARCHAR(4)),2,2) AS "YY" 
FROM SOMESCHEMA.FOO;

出现以下错误:

  1. [Code: -104, SQL State: 42601] ILLEGAL SYMBOL ",2". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.26.14
  2. [Code: -514, SQL State: 26501] THE CURSOR SQL_CURLH200C1 IS NOT IN A PREPARED STATE. SQLCODE=-514, SQLSTATE=26501, DRIVER=4.26.14

无论我怎么改,错误仍然存​​在..

DB2 z/OS 的解决方案是:

VARCHAR_FORMAT(SOMEDATE, 'YY') AS "YY"