-1
create or replace trigger employee_age_constraint
before insert on employee
for each row
begin
  if floor(months_between(current_date,:New.employee_birthdate)/12) < 13 then 
    raise_application_error(123123, 'asf')
  end if; 
end;

I keep on getting this error with this code on Oracle SQL developer, i have no idea why, help please!

user2784327
  • 401
  • 1
  • 7
  • 10
  • 2
    Missing a semi-colon after `raise_application_error`? – Phil Sep 20 '13 at 04:14
  • 1
    This question appears to be off-topic because it is about a missing semi-colon. – Ben Sep 20 '13 at 06:01
  • 1
    I cannot emphasise this enough. **DO NOT STORE AGE IN YOUR DATABASE** (or next birthday or whatever this is meant to represent) your constraint is useless unless you regularly update the entire table. If you regularly update the entire it just takes it to not be run once (or to be run twice) and you're in serious trouble. [See, for instance my answer here](http://stackoverflow.com/questions/12329149/calculating-age-from-birthday-with-oracle-plsql-trigger-and-insert-the-age-in-ta/12329295#12329295) – Ben Sep 20 '13 at 06:03
  • You seem to be checking that when an employee changes their date of birth (how common is this?) that they're less than a year old... – Ben Sep 20 '13 at 06:04

1 Answers1

1

You have to insert ; after : raise_application_error(123123, 'asf')

you must end your line with this. have a good time.

Farid
  • 21
  • 4