Hi all,
I'm trying to calculate the number of years of a product when a new record is inserted.
this is what i've tried
CREATE TABLE WaterMeter (
meterID VARCHAR(25) NOT NULL,
readingID VARCHAR(25) NOT NULL,
meterSerialNum VARCHAR(25) NOT NULL,
installationDate DATE NOT NULL,
noOfYears AS (DATEDIFF (YEAR, sysdate, installationDate)),
CONSTRAINT watermeter_Pkey PRIMARY KEY (meterID),
CONSTRAINT watermeter_Altkey UNIQUE (meterSerialNum)
);
and the following error has appeared.
Error at Command Line:6 Column:27
Error report:
SQL Error: ORA-00904: "YEAR": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
so how do I go around solving this issue?