LRNO + INNO (incident number).
ABSD_CAGE1 is the master incident record; all other CA* tables are child records.
Every CA* and HA* trigger writes ABSD_CALA.EDITOR + ABSD_CALA.EDIT_DATE
as a cross-table audit timestamp — this is the "last touched" stamp used by the APS system
(Production_Casualties table). It is separate from the J06 audit on ABSD_OVGE.
Casualty location/attributes — the anchor record for each incident. The trigger body was almost entirely disabled when Events 3.0 went live in July 2016. The only active code is a self-referencing EDITOR/EDIT_DATE stamp. All validation, geo-conversion, and staging logic is commented out.
fnConvertDegreesMinsToDecimal,
Marsden Grid derivation via fnMarsdenGrid, SIS Zone via fnSISZone,
cascaded updates to ABSD_CAGE1.MGS/MGE/ZNES/ZNEE
and ABSD_CADI.MG/ZONE, ABSD_CALA_UPDATES staging, and
annotation logging. All of this was commented out at Events 3.0 cutover. The old code also had
a dual guard (TRIGGER_DISABLE + TRIGGER_DISABLE_CALA).
UPDATE ABSD_CALA SET EDITOR=..., EDIT_DATE=...
on the rows being inserted/updated. This self-update ensures APS can detect the change
via EDIT_DATE when querying Production_Casualties. There is no TRIGGER_DISABLE guard
on this active code — it always fires.
Master incident record. Controls incident type (casualty vs. disposal), date validation, other-vessel linking, auto-creation of disposal records, OLR cascade to other vessels, and OWCA rebuild. Old set-based version replaced with scalar-variable version for performance July 2010 (MRE). Note: EDIT_DATE on ABSD_CALA is the timestamp used by APS — updated on every CAGE1 write (MW comment 19/12/2017).
TRIGGER_DISABLE guardIF (SELECT INNO FROM inserted) IS NOT NULL — trigger body only executes when an incident number is presentDISP IN ('C','X') and REM IS NULL → RAISERROR: "The Removal From Scene must be filled for a casualty"STD (start date, nullable) — valStandard9Non99 (differs from valStandard9new — rejects '99' dates)ENDD (end date, nullable) — valStandard9Non99OLR_1, OLR_2, OLR_3 (other vessels involved, nullable) — each must exist in ABSD_OVGESTDS (start situation, nullable) — FK → ABSD_CBUB1 FLDI='20' (COLLATE SQL_Latin1_General_CP1_CS_AS)STCS (start cause/circumstances, nullable) — FK → ABSD_CBUB1 FLDI='22' (COLLATE SQL_Latin1_General_CP1_CS_AS)DISP IN ('D','X') — only one demolition/disposal record per vessel allowed; RAISERROR if a second is attemptedKNO (killed number, nullable) — must be NULL or exactly 5 characters (zero-padded, e.g. 00018)INO (missing number, nullable) — must be NULL or exactly 5 charactersABSD_CADI disposal record exists for this LRNO+INNO, delete it and save INNO to TEMPCADI — a casualty cannot have a disposal recordABSD_CADI record exists, auto-create one: INSERT INTO ABSD_CADI (LRNO, INNO) + matching SUPPLEMENTAL_ABSD_CADI rowDISP='C' if a ABSD_CADI record already exists (checked after all other logic)ABSD_CAGE1 record exists for the OLR vessel+INNO combination:spDeleteCasualty(@OLRLRNO, @OLRINNO) — clears any remnant recordsspCreateNewCasualtyExisitingINNO(@OLRLRNO, @OLRINNO, @LRNO, OLR_position) — creates a mirror incident for the other vessel using the same INNOABSD_CALA EDITOR + EDIT_DATE updated (APS audit trail)LRNO or STD change: rebuild ABSD_OWCA via vwcreateabsd_owca for this LRNO+INNOABSD_CAGE1_UPDATES from insertedINNO groupDelete trigger on CAGE1. Captures deleted incident records into a deletion staging table for downstream processing. Always fires regardless of TRIGGER_DISABLE state.
TRIGGER_DISABLE check — fires unconditionally on every DELETEABSD_CASDEL_UPDATES populated with LRNO, INNO, and editor initials from deleted pseudo-tableIncident supplemental data (second general record). One date validation field. Staging from base table (not inserted — consistent with most non-casualty triggers).
EDTE (event date, nullable) — valStandard9newABSD_CALA EDITOR + EDIT_DATE updatedABSD_CAGE2_UPDATES from base table (SELECT FROM ABSD_CAGE2, not from inserted)INNO groupDisposal/demolition detail record. Calculates total scrap price from light displacement tonnage and AMNT when LDT data is available. Three date fields validated. Active ShipWatch integration (B05 column).
DATE_1, DATE_2, DATE_3 (all nullable) — each validated with valStandard9new when NOT NULLAMNT change: if SUPPLEMENTAL_ABSD_HITL.LDT is set for this vessel (SEQNO='00')UPDATE SUPPLEMENTAL_ABSD_CADI SET TOTAL_SCRAP_PRICE = LDT × (AMNT / 100)CAST(RIGHT(AMNT,9) AS INT)ABSD_CALA EDITOR + EDIT_DATE updatedABSD_CADI_UPDATES from inserted (not base table)ABSD_AWSH_UPDATES.B05 = 'Y' — INSERT if no existing row, UPDATE if row existsINNO groupABSD_AWSH_UPDATES.C01='Y'. This is commented out
in the current trigger — only B05 is active.
Casualty contact/source records. On TEXT_1 update for SNO='01', auto-creates an ABSD_CAPR (precis) record if one does not already exist and the incident is not a disposal (DISP≠'D').
TEXT_1 update, when SNO='01':ABSD_CAPR record for this LRNO+INNO, AND ABSD_CAGE1.DISP ≠ 'D':INSERT INTO ABSD_CAPR (LRNO, INNO, LNS1, LNS2, LNS3, LNS4) SELECT... from insertedABSD_CALA EDITOR + EDIT_DATE updatedABSD_CACO_UPDATES keyed by LRNO+INNO+SNOSCE_DATE groupCasualty action text lines. No field validation. Standard CALA audit, staging, and annotation pattern.
ABSD_CALA EDITOR + EDIT_DATE updatedABSD_CACT_UPDATES keyed by LRNO+INNOLNS groupCasualty general contact data. No field validation. Standard CALA audit, staging, and annotation pattern.
ABSD_CALA EDITOR + EDIT_DATE updatedABSD_CAGC_UPDATES keyed by LRNO+INNOINNO groupCasualty port data. No validation. Staging uses straight DELETE+INSERT without EXISTS check (unlike most triggers that check first).
ABSD_CALA EDITOR + EDIT_DATE updatedABSD_CAPO_UPDATES — unconditional DELETE then INSERT from insertedINNO groupCasualty precis/narrative lines. No validation. Note: CAPR records can also be auto-created by the CACO trigger when source text is entered for SNO='01'.
ABSD_CALA EDITOR + EDIT_DATE updatedABSD_CAPR_UPDATES from insertedINNO groupOWCODE (company code), not LRNO.
They record adverse history at the company level. J06 audit is written to ABSD_OVGE
using a LRNO derived from inserted/deleted, but the staging table key is
the company-based composite. Both tables have DELETE triggers that write J06 without checking
TRIGGER_DISABLE.
Historic adverse address records. Company-level adverse address history. The DELETE trigger writes J06 without a TRIGGER_DISABLE guard.
TRIGGER_DISABLE guardABSD_OVGE keyed by LRNO from insertedABSD_HAAD_UPDATES keyed by OWCODE + OWDATE + SEQNOA; but staging SELECT is FROM ABSD_HAAD WHERE OWCODE IN (...) — fetches all rows for the company, not just changed rowsTRIGGER_DISABLE guard — fires unconditionally on every DELETEABSD_OVGE keyed by LRNO from deletedHistoric adverse contact records. Five-part composite staging key. Same pattern as HAAD for delete trigger.
TRIGGER_DISABLE guardABSD_OVGEABSD_HACO_UPDATES keyed by OWCODE + OWDATE + OWSEQN + TYPE + SEQN (5-part); SELECT from ABSD_HACO WHERE OWCODE IN (...) — all rows for company refreshedTRIGGER_DISABLE guard — fires unconditionallyABSD_OVGE keyed by LRNO from deleted| Trigger | Guard | Key | Validation | Staging Table | Notable Rules |
|---|---|---|---|---|---|
CALA_Update | NONE (active code) | LRNO+INNO | — | — (disabled Jul 2016) | Self-update only; full body commented out at Events 3.0 |
CAGE1_Update | Standard + INNO IS NOT NULL | LRNO+INNO | valStandard9Non99, OLR FKs, STDS/STCS codebook FKs, KNO/INO length | CAGE1_UPDATES | DISP type logic; OLR cascade; OWCA rebuild; CADI auto-create/delete |
CasDel | NONE | LRNO+INNO | — | CASDEL_UPDATES | FOR DELETE; always fires; captures editor initials |
CAGE2_Update | Standard | LRNO+INNO | EDTE valStandard9new | CAGE2_UPDATES (from base table) | — |
CADI_Update | Standard | LRNO+INNO | DATE_1/2/3 valStandard9new | CADI_UPDATES (from inserted) | Scrap price calc: LDT × AMNT/100; ShipWatch B05 |
CACO_Update | Standard | LRNO+INNO+SNO | — | CACO_UPDATES | Auto-creates CAPR on TEXT_1 when SNO='01' and DISP≠'D' |
CACT_Update | Standard | LRNO+INNO | — | CACT_UPDATES | — |
CAGC_Update | Standard | LRNO+INNO | — | CAGC_UPDATES | — |
CAPO_Update | Standard | LRNO+INNO | — | CAPO_UPDATES | Unconditional DELETE+INSERT (no EXISTS check) |
CAPR_Update | Standard | LRNO+INNO | — | CAPR_UPDATES | Can be auto-populated by CACO trigger |
HAAD_Update | Standard | OWCODE+OWDATE+SEQNOA | — | HAAD_UPDATES | Company-keyed; staging fetches all rows for OWCODE |
HAAD_DELETE | NONE | OWCODE | — | — | FOR DELETE; always fires; J06 only |
HACO_Update | Standard | OWCODE+OWDATE+OWSEQN+TYPE+SEQN | — | HACO_UPDATES | Company-keyed; 5-part staging key |
HACO_DELETE | NONE | OWCODE | — | — | FOR DELETE; always fires; J06 only |