Subject | proposal for new constraint syntax |
---|---|
Author | theo_pana |
Post date | 2010-05-01T08:15:50Z |
what about to add a custom error message for each constraint violation
instead of default system generated
the syntax would be
... constraint <constraint_name> constraint_type errormessage 'some text'
or
... constraint <constraint_name> constraint_type exception <exception_name>
for example:
alter table TABLE1 add constraint CHECK_FILED1 check (FIELD1 > 100)
errormessage 'field must be above 100';
or
create exception TABLE1_FIELD1_ERROR '............';
alter table TABLE1 add constraint CHECK_FILED1 check (FIELD1 > 100)
exception TABLE1_FIELD1_ERROR;
instead of default system generated
the syntax would be
... constraint <constraint_name> constraint_type errormessage 'some text'
or
... constraint <constraint_name> constraint_type exception <exception_name>
for example:
alter table TABLE1 add constraint CHECK_FILED1 check (FIELD1 > 100)
errormessage 'field must be above 100';
or
create exception TABLE1_FIELD1_ERROR '............';
alter table TABLE1 add constraint CHECK_FILED1 check (FIELD1 > 100)
exception TABLE1_FIELD1_ERROR;