P1 and P2 should be in the format YYMM or YYYYMM.
The period arguments P1 and P2 are not date values.
mysql> mysql> SELECT PERIOD_DIFF(9803,199803); +--------------------------+ | PERIOD_DIFF(9803,199803) | +--------------------------+ | 0 | +--------------------------+ 1 row in set (0.00 sec) mysql>