Oracle Update column based on an expression
Posted on 2014-10-04
I have a table which has a calculated VARCHAR2 column based on an event date. Yes, I know that this is not advisable.
age_group is a VARCHAR2 column.
start_date is a DATE column.
I need to set the value of the age_group column.
Psuedocode: Set the value of Table1.age_group equal to 'LT8'
where the number of days since the start date is between 0 and 7.
SET age_group = ‘LT8’
WHERE Table1 .(SysDate-start_date) BETWEEN 0 AND 7 ;
Is this the correct syntax? Does (SysDate - start-date) return a number of days, or do I need to apply a conversion function?