How can I provide a user defined error message in PL/SQL when a check constraint is violated?
CREATE TABLE "AP"."SOURCE"
(
,"RATING" CHAR(30 BYTE)
,"SUBMISSION_STATUS" CHAR(12 BYTE)
,"UOANAME" CHAR(32 BYTE)
,"W_INSERT_DT" TIMESTAMP (6)
,"W_UPDATE_DT" TIMESTAMP (6)
,"SCIVAL_CIT_CATEGORY" NUMBER(5,0)
,"TOTAL_AUTHORS" BINARY_DOUBLE
,"REF2014" CHAR(3 BYTE)
CONSTRAINT "Submission_Rating_not_valid"
CHECK ( Submission_status ='To be scored'
and Rating is null
or Submission_status ='NO'
and Rating is null
or Submission_status = 'Potential'
and Rating is not null
and Rating != 'Not REF Eligible'
or Submission_status ='Yes'
and Rating is not null
and Rating != 'Not REF Eligible'
or Submission_status ='No'
and Rating is not null
and Rating != 'Not REF Eligible'
or Submission_status ='No'
and Rating = 'Not REF Eligible'*) ENABLE
)