10e – Machinery Triggers

LR Maritime Database · Trigger Business Rules Reference · Generated from SQL source 2026-05-03

Overview

The machinery trigger family covers main propulsion (HIMO), auxiliary machinery (MA* series), thruster (MATH), generator sets (HIGE / HIMT), and ship speed (MASP). All machinery triggers were redesigned in January–February 2007 to use cursors for bulk-update support. Two key EDM table migrations occurred in April 2026 for HIMO.

Table / Trigger
ABSD_HIMO / ABSD_HIMO_Update

Main propulsion engine. 4-column composite key (LRNO, SEQNO, POS_CODE, TYPE). Updated Apr 2026 to use EDM tables.

Table / Trigger
ABSD_HIGE / ABSD_HIGE_Update

Generator sets per propulsion position. 3-column composite key (LRNO, SEQNO, POS_CODE).

Table / Trigger
ABSD_HIMT / ABSD_HIMT_Update

Main engine motor/turbine details. Standard (non-cursor) trigger.

Table / Trigger
ABSD_MATH / ABSD_MATH_Update

Thruster data. 3-column key (LRNO, SEQ, TYPE). Status sync with ABSD_HIST.

Table / Trigger
ABSD_MAAU / ABSD_MAAU_Update

Auxiliary generator. 3-column key (LRNO, SEQ, TYPE). AC/DC frequency cross-checks.

Table / Trigger
ABSD_MAEM1–3 / ABSD_MAEMx_Update

Emergency engines 1-3. MAEM1 has dual guard. MAEM1 has LFAN cross-check vs OVTY ship type.

Table / Trigger
ABSD_MASP / ABSD_MASP_Update

Ship speed (trial / service / maximum). Updates SHIP_SEARCH.SSpeed. Multiple conditional annotation groups.

Other MA* Tables
MABO, MABU, MAGR, MAPR, MAST

Boiler, bunker, gearbox, propeller, stability. Follow the standard MA* cursor pattern.

Universal MA* Trigger Pattern All machinery triggers (HIMO, HIGE, MATH, MAAU, MAEM1-3, MABO, MABU, MAGR, MAPR, MAST, MASP) share this structure:
  1. Guard: IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE)
  2. Pre-cursor: batch field-length and enum validations
  3. Cursor on composite key (usually LRNO, SEQ/SEQNO, TYPE or POS_CODE)
  4. Per-row: EFD → valStandard4_new; CC → valStandard2; SRCE → valStandard8; VER → valStandard1
  5. Per-row: Numeric pairs → valStandard3Num
  6. J06 conditional update (author+date only, no J06_LNCHTIME)
  7. UPDATES staging table refresh (delete+insert from base table for LRNO)
  8. Secondary annotation only (no primary field-level annotation)
ABSD_HIMO_Update ON dbo.ABSD_HIMO FOR UPDATE, INSERT ~1,644 lines (cursor, redesigned Jan 2007) EDM Updated Apr 2026

Main propulsion engine trigger. Uses a 4-column composite key (LRNO, SEQNO, POS_CODE, TYPE). In April 2026, two codebook lookups were migrated from ABSD_CBUB3 and ABSD_CBUB1 to EDM.dbo.T_REF_CBUB3 and EDM.dbo.T_REF_CBUB1 respectively. Includes automatic creation of sister records in ABSD_HIPU, ABSD_HIPS, and ABSD_HIPM.

1. Pre-Cursor (Batch) Validations

Mandatory Fields

FieldRuleError Message
DCNOT NULL mandatory"Design code must be completed!"
NEWIN('Y','U','N'), NOT NULL"NEW must be one of U N or Y"

Field Length Constraints

FieldMax Digits
DES_POWER6
POW_KW5
OE01_CN2
OE01_BORE4
OE01_ST1, OE01_ST2, OE01_ST_EX4 each
OE01_RPM_DES4
GTE02_GASSNO1
STE03_AT1
STR04_EXP1
STR04_CN, STR04_HPCN2
STR04_HPCB, STR04_IPCB1, STR04_IPCB2, STR04_LPCB, STR04_CST4 each
STR04_IPCN1, STR04_IPCN2, STR04_LPCN2 each

Enumerated Fields

FieldValid ValuesNotes
TYPE'01','02','03','04'Engine type code
CLASSNULL or IN('*','+','R','U','N')Engine class; nullable — skip check if NULL
DRINDIN('DD','EE','GE','GG','YY','NN')Drive indicator
OE01_RECON_INDIN('Y','U','N')Reconditioning indicator
OE01_SDIN('N','Y')Supercharge/diesel indicator
OE01_ST_TYPIN('2','4','Y','N')Stroke type
OE01_STCYCIN('S','D','Y','N')Stroke cycle

Cross-Field Ordering (Stroke Hierarchy)

  • OE01_ST2 > 0 requires OE01_ST1 > 0. Error: "OE01_ST2 cannot contain a value if OE01_ST1 is 0"
  • OE01_ST_EX > 0 requires OE01_ST2 > 0. Error: "OE01_ST_EX cannot contain a value if OE01_ST2 is 0"

Codebook FK Lookups (EDM tables — Updated Apr 2026)

FieldReference TableConstraintCollation
OE01_CAEDM.dbo.T_REF_CBUB3TABNO='26' (was ABSD_CBUB3 before Apr 2026)Case-sensitive
POSNEDM.dbo.T_REF_CBUB1FLDI='03' (was ABSD_CBUB1 before Apr 2026)Case-sensitive
POS_CODEEDM.dbo.T_REF_CBUB1FLDI='03' (was ABSD_CBUB1 before Apr 2026)Case-sensitive
DCABSD_CBEDMust match ENGKEY OR match pattern 'Z[A-Z][A-Z]' (escape: ZXX = unknown design)Default
EMABSD_CBEB.MMNullable — checked only when not nullDefault
EM2ABSD_CBEB.MMNullable — checked only when not nullDefault

2. Per-Cursor (Per-Row) Validations

FieldValidation SPNotes
EFD, DMvalStandard4_newYYMMDD format
VER, POSN_VER, DC_VER, EM_VER, EM2_VERvalStandard1Confidence code
DESPOW_CC, POWKW_CC, OE01_CN_CC, OE01_BORE_CC, OE01_ST1_CC, OE01_ST2_CC, OE01_ST_EX_CC, OE01_RPM_CC, OE01_SD_VER*, GTE02_GN_CCvalStandard22-char alpha confidence codes (*OE01_SD_VER uses valStandard1)
OE01_ST1_VER, OE01_ST2_VER, OE01_ST_EX_VERvalStandard1Confidence codes

3. Cascade: HIPU / HIPS / HIPM Auto-Creation

-- For each (LRNO, SEQNO, POS_CODE, TYPE) in inserted:
IF NOT EXISTS (SELECT * FROM ABSD_HIPU WHERE LRNO=@L AND POSN=@P AND SEQNO=@S AND TYPE=@T)
  INSERT INTO ABSD_HIPU (LRNO, POSN, SEQNO, TYPE, PU_SEQ) VALUES (..., '00')

IF NOT EXISTS (SELECT * FROM ABSD_HIPS WHERE LRNO=@L AND POSN=@P AND SEQNO=@S AND TYPE=@T)
  INSERT INTO ABSD_HIPS (LRNO, POSN, SEQNO, TYPE, PS_SEQ) VALUES (..., '00')

IF NOT EXISTS (SELECT * FROM ABSD_HIPM WHERE LRNO=@L AND POSN=@P AND SEQNO=@S AND TYPE=@T)
  INSERT INTO ABSD_HIPM (LRNO, POSN, SEQNO, TYPE, PM_SEQ) VALUES (..., '00')

Business Rule: Every main engine record must have corresponding HIPU (propulsion unit), HIPS (propulsion system), and HIPM (propulsion machinery) records. These are automatically created as shell records when a HIMO record is first inserted.

4. J06 Audit Stamp

Conditional update — only writes J06 if the combination of J06_AUTHOR + J06_LNCHDATE does not already match the current user and today's date for this LRNO. Updates J06_AUTHOR and J06_LNCHDATE only (no J06_LNCHTIME). Uses SYSTEM_USER directly.

5. Staging Table

ABSD_HIMO_UPDATES — refreshed with the full set of current HIMO rows for the LRNO (delete+insert from base table).

6. Annotations

TypeField TriggerNotes
Primary (tblChanges)MD (manufacturer date)Standard @IsNew OldValue pattern
SecondaryAlways fires per cursor rowGroup: Tablename='ABSD_HIMO', Fieldname='POSN'
ABSD_HIGE_Update ON dbo.ABSD_HIGE FOR UPDATE, INSERT ~926 lines (cursor, redesigned Feb 2007) Generator Sets

Generator set trigger. Cursor key: (LRNO, SEQNO, POS_CODE). Records electrical generation data per engine position. The HIST trigger sets E45_GS (generator status) when vessel status changes.

1. Pre-Cursor Validations

Field Length Constraints

FieldMax Digits
E45_NO2
E45_KW, E45_VOLT5
E45_FREQ2

AC/DC and Frequency Cross-Checks

  • E45_ACDC: IN('A','D','N','U','Y') when not null
  • When E45_ACDC='A' (Alternating Current): E45_FREQ must be IN('50','60','0'). Error: "E45_FREQ must be 0,50 or 60 when E45_ACDC is A"

Date Cross-Check

  • E45_DM (manufactured date) must NOT be > E45_EFD (effective date). Exception: E45_DM='198099' is a sentinel value meaning "pre-1980" and is allowed to exceed EFD. Error: "E45_DM may not be greater than E45_EFD"
  • When E45_GS='8' (retired/scrapped): E45_EFD must NOT be > E45_ST (stop date). Error message reuses the "E45_DM" phrasing (a copy-paste bug in the original code).

Codebook FK Lookups

FieldReferenceNotes
E45_PM_POS_1 through E45_PM_POS_9ABSD_CBUB1 FLDI='03'Engine position codes; E45_PM_POS_1 may be non-null; 2-9 checked only when not null. Case-sensitive collation.
E45_GMABSD_CBEB.MMGenerator make; not null required
E45_GSABSD_CBUB1 FLDI='19'Generator status. Exception: code '8' is not validated against codebook (hardcoded sentinel for retired generators).
Note: HIGE uses ABSD_CBUB1 directly (not EDM version) The HIGE trigger was not updated in the April 2026 EDM migration. Unlike HIMO, it still references ABSD_CBUB1 directly for E45_PM_POS_1–9 and E45_GS lookups.

2. Per-Cursor Validations

FieldValidation SP
E45_EFD, E45_DM, E45_STvalStandard4_new
E45_VER, E45_POS_VER, E45_GM_VER, E45_DM_VER, E45_ST_VERvalStandard1
E45_DPIvalStandard2
E45_NO_CC+E45_NO, E45_KW_CC+E45_KW, E45_VOLT_CC+E45_VOLTvalStandard3Num

3. J06 / Staging / Annotations

  • J06: conditional update, J06_AUTHOR + J06_LNCHDATE only
  • Staging: ABSD_HIGE_UPDATES — refreshed per LRNO
  • Secondary annotation: Tablename='ABSD_HIGE', Fieldname='E45_EFD' — always fires per cursor row
  • No SHIP_SEARCH update
ABSD_HIMT_Update ON dbo.ABSD_HIMT FOR UPDATE, INSERT ~494 lines (standard, not cursor-based) Motor / Turbine Details

Main engine motor / turbine details trigger. Unlike most machinery triggers, HIMT was not rewritten as a cursor trigger in 2007. It processes the full inserted set as a batch. The commented-out ABSD_AWSH_UPDATES block (ShipWatch integration) was deactivated.

1. Field Validations

Length Constraints

FieldMax Digits
E54_NO2
E54_SHP_PO6
E54_KW_PO5
E54_FREQ2

Enumerated Fields

FieldValid Values
E54_SHP_TY'D','S','M','U','N','Y' (shaft power type)
E54_KW_TY'D','S','M','U','N','Y' (kW power type)
E54_ACDC'D','A','U','N','Y'
E54_MCS'C','S','T','W','Y','D','N','U' (motor/control system)

Validation SPs

Field(s)Validation SP
E54_EFD, E54_DM, E54_STvalStandard4_new
E54_VER, E54_POS_VERvalStandard1
E54_SRCEvalStandard8
E54_NO_CC+E54_NO, E54_SHP_CC+E54_SHP_PO, E54_KW_CC+E54_KW_POvalStandard3Num
E54_NO_CC, E54_SHP_CC, E54_KW_CCvalStandard2 (double-validated — also as part of the Num pair)

Codebook Lookups

FieldReferenceNotes
E54_POSNABSD_CBUB1 FLDI='03'Mandatory, case-sensitive
E54_PM_POS_1ABSD_CBUB1 FLDI='03'Mandatory for first position
E54_PM_POS_2 through _9ABSD_CBUB1 FLDI='03'Checked only when not null
E54_MMABSD_CBEB.MMMotor/turbine make

2. J06 / Staging / Annotations

  • J06: J06_AUTHOR + J06_LNCHDATE only (non-conditional — always updates); uses SYSTEM_USER directly
  • Staging: ABSD_HIMT_UPDATES
  • Secondary annotation: Tablename='ABSD_HIMT', Fieldname='E54_EFD'
  • No SHIP_SEARCH update
ABSD_MATH_Update ON dbo.ABSD_MATH FOR UPDATE, INSERT ~475 lines (cursor, redesigned Feb 2007) Thruster Data

Thruster data trigger. Cursor key: (LRNO, SEQ, TYPE). Contains a special business rule that syncs the thruster status field with the vessel's current live status when a new thruster is added.

1. Pre-Cursor Validations

Length Constraints

FieldMax Digits
E95_THST_NO1
E95_THST_BHP, E95_LATT_BHP6
E95_THST_KW5

Thruster Type and Number Rules

RuleError
E95_THST_TYP: must be in ABSD_CBUB1 FLDI='47' (case-sensitive)"The code in E95_THST_TYP does not match a record in table 47 of CBUB1"
When E95_THST_TYP NOT IN ('NN','UU','YY'): E95_THST_NO must be > 0 (added Dec 2007)"The code in thruster type requires number of thrusters to be greater than 0."
When E95_THST_TYP='YY': all other ABSD_MATH rows for the same LRNO must also have E95_THST_TYP='YY' (cross-row consistency)"If a the code in E95_THST_TYP is 'YY' other thrusters should be set to the same code."
When E95_THST_TYP='NN': both E95_THST_BHP and E95_THST_KW must be 0"Thruster type cannot be none when a power is specified"

2. Per-Cursor Validations

Field(s)Validation SP
E95_EFDvalStandard4_new
E95_CCvalStandard2
E95_SRCEvalStandard8
E95_THSTNO_CC+E95_THST_NO, E95_THBHP_CC+E95_THST_BHP, E95_THKW_CC+E95_THST_KWvalStandard3Num

Multi-Zero Constraint

  • If E95_THST_NO=0 for the current row AND another row already exists for the same LRNO with a different SEQ and E95_THST_NO=0: RAISERROR "Number of Thrusters (E95_THST_NO) must not be 0 if another 0 record exists"

3. Thruster Status Auto-Sync

Business Rule: New Thruster Inherits Vessel Status Added 15/02/2006 (TRW): When E95_THST_NO changes AND the new value > 0 AND ABSD_HIST.A02_STS ≠ E95_THST_STAT AND vessel status NOT IN ('9','B','G','H','V') (i.e., vessel is in an active/reportable state): UPDATE ABSD_MATH SET E95_THST_STAT = ABSD_HIST.A02_STS for the vessel. This ensures that when a thruster is first recorded, it immediately reflects the vessel's current live status.

4. J06 / Staging / Annotations

  • J06: conditional, J06_AUTHOR + J06_LNCHDATE only
  • Staging: ABSD_MATH_UPDATES
  • Secondary annotation: Tablename='ABSD_MATH', Fieldname='E95_POSSHIP_1'
  • No SHIP_SEARCH update
ABSD_MAAU_Update ON dbo.ABSD_MAAU FOR UPDATE, INSERT ~701 lines (cursor, redesigned Feb 2007) Auxiliary Generator

Auxiliary generator trigger. Cursor key: (LRNO, SEQ, TYPE). Contains AC/DC and frequency cross-validation rules that are more complex than HIGE's equivalent.

1. Pre-Cursor Validations

Length Constraints

FieldMax Digits
E89_GEN_NO2
E89_GEN_VOLT1, E89_GEN_VOLT24
E89_FREQ_HZ2

AC/DC and Frequency Cross-Checks

ConditionError
E89_ACDC_IND='A' and E89_FREQ_HZ NOT IN('50','60','0')"E89_FREQ_HZ must be 0,50 or 60 when E89_ACDC_IND is A"
E89_ACDC_IND IN('N','U') and (E89_FREQ_HZ ≠ 0 OR E89_FHZ_CC NOT IN('U','N'))"E89_FHZ_CC must be N or U when E89_ACDC_IND is N and E89_FREQ_HZ ≠ 0"
E89_FHZ_CC='Y' and E89_ACDC_IND='A'"E89_ACDC_IND must not be A when E89_FHZ_CC is Y"

Codebook

  • E89_GEN_MAKE: must be in ABSD_CBEB.MM (generator manufacturer)

2. Per-Cursor Validations

Field(s)Validation SP
E89_EFDvalStandard4_new
E89_SRCEvalStandard8
E89_VERvalStandard1
E89_CC, E89_MENG_DRVNvalStandard2
E89_GENNO_CC+E89_GEN_NO, E89_GENKW_CC+E89_GEN_KW, E89_GVOLT1_CC+E89_GEN_VOLT1, E89_GVOLT2_CC+E89_GEN_VOLT2, E89_FHZ_CC+E89_FREQ_HZvalStandard3Num

3. J06 / Staging / Annotations

  • J06: conditional, J06_AUTHOR + J06_LNCHDATE only
  • Staging: ABSD_MAAU_UPDATES
  • Secondary annotation: Tablename='ABSD_MAAU', Fieldname='E89_EFD'
  • No SHIP_SEARCH update
ABSD_MAEM1_Update ON dbo.ABSD_MAEM1 FOR UPDATE, INSERT ~673 lines (cursor, redesigned Feb 2007) Emergency Engine 1 Dual Guard

Emergency engine #1 trigger. Cursor key: (LRNO, SEQ, TYPE). The only machinery trigger with a dual guard. Contains a cross-table check against ABSD_OVTY for the landing fan indicator.

1. Guard Architecture

IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE)
BEGIN
  IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE_MAEM1)
  BEGIN
    -- all logic
  END
END

The inner TRIGGER_DISABLE_MAEM1 guard is used to suppress the MAEM1 trigger during bulk operations that update multiple emergency engine records programmatically.

2. Pre-Cursor Validations

Length Constraints

FieldMax Digits
E88_OILENG_NO2
E88_OLENG_BHP6
E88_OILENG_KW5

Propulsion Secondary Indicator

RuleError
E88_SEC_IND: IN('E','S','N','U','Y')"E88_SEC_IND must be one of E S U N or Y"
When E88_SEC_IND IN('E','S','Y'): E88_PROP_TEXT must NOT be NULL"E88_PROP_TEXT must contain text when E88_SEC_IND is one of E S or Y"

Cross-Table Check: Lifting Fan vs Ship Type

Business Rule: Lifting Fan Requires Hovercraft/Cushion Craft Type When E88_LFAN_IND='Y' (lifting fan indicator): The vessel's current ship type (ABSD_OVTY.D01_INT_BASIC at SEQNO='00') must begin with '6' (hovercraft/air cushion vessel type codes). Error: "When E88_LFAN_IND is Y, D01_INT_BASIC must begin 6"

Codebook

  • E88_GEAR_TYP: ABSD_CBUB1 FLDI='35' (gearbox type, case-sensitive)

3. Per-Cursor Validations

Field(s)Validation SP
E88_EFDvalStandard4_new
E88_CCvalStandard2
E88_SRCEvalStandard8
E88_VER, E88_OEBHP_VER, E88_OEKWP_VER, E88_GEART_VERvalStandard1
E88_LFAN_INDvalStandard2
E88_OEN_CC+E88_OILENG_NO, E88_OEBHP_CC+E88_OLENG_BHP, E88_OEKW_CC+E88_OILENG_KWvalStandard3Num

4. J06 / Staging / Annotations

  • J06: conditional, J06_AUTHOR + J06_LNCHDATE only
  • Staging: ABSD_MAEM1_UPDATES
  • Secondary annotation: Tablename='ABSD_MAEM1', Fieldname='E88_EFD'

5. MAEM2 and MAEM3

ABSD_MAEM2 and ABSD_MAEM3 follow the identical structure as MAEM1 but for the second and third emergency engines. Both use the dual guard pattern (TRIGGER_DISABLE + TRIGGER_DISABLE_MAEM2/MAEM3) and the same field validations with E88_ prefix fields.

ABSD_MASP_Update ON dbo.ABSD_MASP FOR UPDATE, INSERT ~412 lines (cursor, redesigned Feb 2007) Ship Speed SHIP_SEARCH SSpeed

Ship speed trigger. Records trial speed (E83), service speed (E84), maximum speed (E85), and unspecified speed (E86). The trigger updates ABSD_SHIP_SEARCH.SSpeed using a waterfall: service speed if available, otherwise maximum speed. Has four conditional annotation groups (one per speed type).

1. Pre-Cursor Validations

RuleError
E84_SERVICE_SPD > 60"E84_SERVICE_SPD cannot be over 60"
E85_MAXIMUM_SPD > 60"E85_MAXIMUM_SPD cannot be over 60"

2. Per-Cursor Validations

Field(s)Validation SP
E83_EFDvalStandard4_new
E83_CCvalStandard2
E83_SRCEvalStandard8
E83_VERvalStandard1
E84_SS_CC+E84_SERVICE_SPDvalStandard3Num
E85_MS_CC+E85_MAXIMUM_SPDvalStandard3Num

3. ABSD_SHIP_SEARCH Maintenance

-- Service speed takes priority over maximum speed:
UPDATE ABSD_SHIP_SEARCH SET SSpeed =
  CASE WHEN ISNULL(E84_SERVICE_SPD,0) = 0
       THEN E85_MAXIMUM_SPD
       ELSE E84_SERVICE_SPD
  END
FROM ABSD_SHIP_SEARCH INNER JOIN INSERTED ON ABSD_SHIP_SEARCH.LRNO = INSERTED.LRNO
WHERE INSERTED.LRNO = @INDEXLRNO

Fires when E84_SERVICE_SPD or E85_MAXIMUM_SPD is updated. No SEQNO filter — updates SHIP_SEARCH regardless of which sequence number is changed.

4. Conditional Secondary Annotations (4 groups)

Trigger ConditionAnnotation Group (Fieldname)
E83_EFD OR E83_SRCE OR E83_TRIAL_SPD changesTablename='ABSD_MASP', Fieldname='E83_EFD'
E84_EFD OR E84_SRCE OR E84_SERVICE_SPD changesTablename='ABSD_MASP', Fieldname='E84_EFD'
E85_EFD OR E85_SRCE OR E85_MAXIMUM_SPD changesTablename='ABSD_MASP', Fieldname='E85_EFD'
E86_EFD OR E86_SRCE OR E86_UNSPEC_SPD changesTablename='ABSD_MASP', Fieldname='E86_EFD'

Unlike most MA* triggers where a secondary annotation always fires, MASP fires up to four conditional annotations. Multiple can fire in a single update if multiple speed types are changed.

5. J06 / Staging

  • J06: conditional, J06_AUTHOR + J06_LNCHDATE only
  • Staging: ABSD_MASP_UPDATES

Remaining MA* Triggers — Common Pattern

The following machinery triggers follow the standard MA* cursor pattern without special exceptions. They are documented here as a group.

Table Subject Key Prefix Unique Rules Staging Table Secondary Ann. Fieldname
ABSD_MABO Boiler E63_ E63_NO max 2; E63_PRESS max 5; E63_BOILER_TYP → CBUB1 FLDI='06' ABSD_MABO_UPDATES E63_EFD
ABSD_MABU Bunker capacity E79_ E79_FUEL_TYP → CBUB1 FLDI='??'; capacity fields max 6 ABSD_MABU_UPDATES E79_EFD
ABSD_MAGR Gearbox / reduction gear E66_ E66_GEAR_TYP → CBUB1; ratio fields; pairs validated with valStandard3Num ABSD_MAGR_UPDATES E66_EFD
ABSD_MAPR Propeller E73_ E73_PROP_TYP → CBUB1 FLDI='??'; E73_PROP_DIA max 4; E73_PROP_NO max 2; pairs validated ABSD_MAPR_UPDATES E73_EFD
ABSD_MAST Stability data E87_ E87_GM max 5; cross-checks on metacentric height values ABSD_MAST_UPDATES E87_EFD

Standard MA* Trigger Pattern (All above triggers)

  1. Guard: TRIGGER_DISABLE only (except MAEM1–3 which add a second guard)
  2. Pre-cursor: Length checks, enum checks, codebook FK checks (all against ABSD_CBUB1 or ABSD_CBEB, not EDM versions)
  3. Cursor: INSENSITIVE CURSOR FOR SELECT LRNO, SEQ, TYPE FROM inserted
  4. Per-row: EFD → valStandard4_new; SRCE → valStandard8; VER → valStandard1; CC → valStandard2
  5. Per-row: Numeric pairs → valStandard3Num
  6. J06: conditional update (skips if already set today), J06_AUTHOR+J06_LNCHDATE only
  7. Staging: Delete old + insert current from base table for LRNO
  8. Secondary annotation: always fires per row; no primary annotation
  9. No SHIP_SEARCH update (except MASP)

Machinery Triggers Cross-Reference

Trigger Guard Cursor Key EDM Tables? J06_LNCHTIME SHIP_SEARCH Cascade Special Rules
HIMO TRIGGER_DISABLE LRNO, SEQNO, POS_CODE, TYPE Yes — Apr 2026 No Auto-create HIPU/HIPS/HIPM DC ZXX escape code; stroke hierarchy; EDM ref tables
HIGE TRIGGER_DISABLE LRNO, SEQNO, POS_CODE No No DM≤EFD rule; E45_GS='8' sentinel; ACDC/freq cross-check
HIMT TRIGGER_DISABLE None (batch) No No Not cursor-based; AWSH_UPDATES commented out
MATH TRIGGER_DISABLE LRNO, SEQ, TYPE No No MATH.E95_THST_STAT ← HIST.A02_STS YY consistency rule; NN+power rule; multi-zero constraint
MAAU TRIGGER_DISABLE LRNO, SEQ, TYPE No No Complex AC/DC/freq 3-way cross-check
MAEM1–3 TRIGGER_DISABLE + TRIGGER_DISABLE_MAEMn LRNO, SEQ, TYPE No No E88_LFAN_IND→OVTY type '6%' check; E88_SEC_IND→PROP_TEXT
MASP TRIGGER_DISABLE LRNO, SEQ, TYPE No No SSpeed Speed max 60; service→max waterfall; 4 conditional annotation groups
MABO, MABU, MAGR, MAPR, MAST TRIGGER_DISABLE LRNO, SEQ, TYPE No No Standard pattern; codebook lookups only

Architectural Notes

The Staging Table Pattern

All MA* triggers maintain a shadow staging table (e.g., ABSD_HIMO_UPDATES, ABSD_MATH_UPDATES). These tables contain the latest complete machinery data for each vessel and are used by downstream processes (ShipWatch feeds, bulk export jobs) to detect changes without polling the main tables. The pattern is always:

IF EXISTS (SELECT * FROM ABSD_XXXX_UPDATES WHERE LRNO = @INDEXLRNO)
  DELETE FROM ABSD_XXXX_UPDATES WHERE LRNO = @INDEXLRNO
INSERT ABSD_XXXX_UPDATES SELECT * FROM ABSD_XXXX WHERE LRNO = @INDEXLRNO

Note: the staging table receives the full set of rows for that LRNO from the base table (not just the single row being changed), so it always reflects all records for the vessel.

The J06 Conditional Pattern

All MA* and machinery triggers (except HIMT) use a conditional J06 update to avoid unnecessary writes:

IF NOT (SELECT COUNT(*) FROM ABSD_OVGE
        WHERE J06_AUTHOR = @author AND J06_LNCHDATE = @today AND LRNO = @INDEXLRNO) > 0
  UPDATE ABSD_OVGE SET J06_AUTHOR = ..., J06_LNCHDATE = ... WHERE LRNO = @INDEXLRNO

This means that if the same editor has already touched the vessel today, the J06 timestamp is not updated again. This differs from the ownership triggers (HIOW, HIMA, HISM) which use spGetUserSettings and always update J06 including J06_LNCHTIME.

EDM Migration Status (April 2026)

As of April 2026, only ABSD_HIMO has been migrated to use EDM reference tables for codebook lookups. All other machinery triggers (HIGE, HIMT, MATH, MAAU, MAEM1–3, MABO, MABU, MAGR, MAPR, MAST, MASP) still reference ABSD_CBUB1, ABSD_CBUB3, and ABSD_CBEB directly.