stcwp
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
STCW.TR_LEGAL_DOCUMENT_AFTER_INSERT
Parameters
Name
Type
Mode
Definition
TRIGGER "STCW"."TR_LEGAL_DOCUMENT_AFTER_INSERT" after insert or update of name on legal_document DECLARE duplicateLegalDocumentName EXCEPTION; totalActiveRecords INTEGER; BEGIN for i in 1 .. state_pkg.newRows.count loop SELECT COUNT (b.name) INTO totalActiveRecords FROM legal_document b WHERE lower(trim(b.name)) = lower(trim(state_pkg.newRows(i))) and b.enum_status_id <>2; IF totalActiveRecords > 1 THEN RAISE duplicateLegalDocumentName; END IF; end loop; EXCEPTION WHEN duplicateLegalDocumentName THEN Raise_application_error(-20325,'Duplicate legal document with same status'); END;