in "beneficiary" table have "birthdate" column, when beneficiary registered, want check, if not adult (no more 18 year), want disallow register
for example today "2017-04-05" , if beneficiary tries insert birth date "1999-04-06", want disallow insert. if birth date "1999-04-05" or earlier, insert must happen.
after searched found trigger this? tried several ways not realized how add restriction table.
you can use this:
(if never update birthdate column, can remove piece: or update
, recreate trigger )
create trigger trg before insert or update on beneficiary each row begin if :new.birthdate > add_months(sysdate , -12*18) raise_application_error(-20001, 'underage user'); end if; end;
Comments
Post a Comment