I'm still new in msyql database trigger. I would like to ask about my lines:
CREATE TRIGGER secure_dml3
BEFORE DELETE ON t_pembelian
BEGIN
IF (SELECT TO_CHAR (SYSDATE,'DY') IN ('SUN')) OR
(SELECT TO_CHAR (SYSDATE, 'HH24:MI') NOT BETWEEN '09.45' AND '20.30')
THEN
IF DELETING THEN
CALL RAISE_APPLICATION_ERROR (-20502,'Perubahan pada data hanya dapat dilakukan hanya pada jam kerja.');
END IF;
END IF;
END
Mysql always say that there is an error near
'BEGIN IF (SELECT TO_CHAR (SYSDATE,'DY') IN ('SUN')) OR (SELECT TO_CHAR (SYSD' at line 3.
I really need your help. Thank you
I think you are confusing oracle with MySql. In MySql doesn't exist TO_CHAR
you may use DATE_FORMAT(SYSDATE,'DY')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.