Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add Days to Date Within Update

BaonergesSep 21 2023

Hi Everyone,

I am trying to add days to my date in an update statement. I have an interactive grid. When a line is updated and set to completed, it records the completed date, then adds 365 days to that date for the expiry date like below.

BEGIN 

case :APEX$ROW_STATUS 
when 'U' then

	UPDATE TABLE1 SET
		COMP_DATE = :COMP_DATE,
		EXP_DATE = :COMP_DATE + 365
		--EXP_DATE = SYSDATE + 365 ***THIS WORKS***
	WHERE ROWID = :ROWID;

end case; 

END;

When trying to add days to :COMP_DATE, I'm getting a “ORA-00932: inconsistent datatypes: expected DATE got NUMBER” error. SYSDATE + 365 works perfectly fine though.

Is there a special way to add days to a date value in an interactive grid? I have also tried declaring a variable, adding days to that date variable, then setting EXP_DATE = ExpDate, but had the same issue.

This post has been answered by Scott Wesley on Sep 22 2023
Jump to Answer
Comments
Post Details
Added on Sep 21 2023
1 comment
1,788 views