I’m creating a table that has an employees start and end date in which they were hired, and I’m trying to find the easiest way to figure out when that persons end date would be. The end date is based on the start date and the length of the contract, both of which are located in the same Insert. This is what I just attemped (my previous attempts were more brutal than this):
Insert Into EMPHIREINFO (empno, empname, startdt, enddt, cntrlgth)
Values (7566,'JONES', to_date('2011/10/15', 'yyyy/mm/dd'),add_months(startdt,cntrlgth), 12);
I have used add_months in an Update so I attempted to use it in an Insert with much less success. I thought it might be the fact that I’m using cntrlgth before inserting it, but even when I hard code the amount of months I want to add, I still error out.
Here is the error in case anyone was interested:
00933. 00000 - "SQL command not properly ended"
Any help is appreciated, thanks.
You can not reference other columns in insert. Is needed write expressions for both: