Hi I’m using sqldeveloper connected to an oracle server. I’m trying to change the date to the monday of that week in a trigger but it says Warning: execution completed with warning, can anyone see what I am doing wrong here?
CREATE OR REPLACE TRIGGER trg_week_menu
BEFORE INSERT OR UPDATE OF week_start ON week_menu FOR EACH ROW
BEGIN
IF DATEPART(dw, :NEW.week_start) != 1 THEN
SELECT DATEADD(ww, DATEDIFF(ww, 0, :NEW.week_start), 0)
INTO :NEW.week_start
FROM sys.dual;
END IF;
END;
Thanks in advance! =)
It’s probably because
datediffanddateaddare SQL-Server functions, not Oracle.From what I understand you’re trying to do this should work:
But in case I don’t understand what you’re trying to do. There’s a number of date functions in Oracle that you should probably be aware of.