10f – Cargo & Capacity Triggers

LR Maritime Database · ABSD_FU* Trigger Series · Business Rules & Transformation Logic

Overview

The FU* trigger series guards the cargo, capacity, and operational characteristics tables. These triggers enforce data quality rules for vessel load data that flows downstream into SHIP_SEARCH (the public-facing vessel search index) and into ShipWatch analytics feeds.

Naming Convention – Header vs. Detail Tables Tables with a 1 suffix (FUCA1, FUCO1, FUDI1, FUHA1, FULI1, FURO1, FUST1, FUUN1) hold the single summary/header row per vessel. Tables with a 2, 3, or 4 suffix hold child detail rows. The header trigger typically validates all field-level business rules; the detail triggers apply FK lookups and simpler checks. All DELETE triggers fire unconditionally (no TRIGGER_DISABLE guard) and only write a J06 audit entry.
Trigger Count
~42 triggers across 22 tables
Guard
TRIGGER_DISABLE (global)
TRIGGER_DISABLE_FUTO (per FUTO)
SHIP_SEARCH Updates
FUGE → GASCAP, INSULATEDCAP, LIQUID, GRAIN, BALE, PASSENGERS, OILCAP
EDM Migrations
FUUN1 (Apr 2026): CBUB3 → EDM.dbo.T_REF_CBUB3
J06 Audit
All triggers write J06_AUTHOR + J06_LNCHDATE; no triggers write J06_LNCHTIME
Cursor-based triggers
FUDI1 (Oct 2007), FUGE (Aug 2007), FUST1 (Aug 2007)

Standard FU* Trigger Execution Flow

  1. Guard checkIF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE). All UPDATE/INSERT triggers except FUOF and the DELETE triggers check this. FUTO adds an inner TRIGGER_DISABLE_FUTO guard.
  2. Field-level validation – Length checks (LEN > N), format checks via valStandard4_new (EFD dates), valStandard8 (source codes), valStandard1 (version flags), valStandard2 (confidence codes), valStandard3Num (CC/value pairs).
  3. FK lookups – Explicit COUNT(*) joins against ABSD_CBUB1, ABSD_CBUB3 (or EDM.dbo.T_REF_CBUB3) using case-sensitive collation COLLATE SQL_Latin1_General_CP1_CS_AS.
  4. Cross-checks – Numeric relationships and inter-table consistency (e.g. lane length ÷ lane count ≤ LOA).
  5. J06 auditUPDATE ABSD_OVGE SET J06_AUTHOR = ..., J06_LNCHDATE = ... for all affected LRNOs.
  6. Staging table refresh – DELETE + INSERT from ABSD_XXXX_UPDATES shadow table.
  7. Secondary annotation – Insert into tblAnnotationLogGeneral via grouping lookup from indAnnotation_SecondaryGroupings.

FUCA1 / FUCA2 – Cargo Capacity

ABSD_FUCA1_Update Table: dbo.ABSD_FUCA1 FOR UPDATE, INSERT Summary row

Purpose

ABSD_FUCA1 holds the single cargo capacity summary record per vessel. The trigger validates the effective date and source code, writes the J06 audit stamp, refreshes the staging shadow table, and logs a secondary annotation.

Business Rules & Validations

  • D08_EFD (effective date) — validated via valStandard4_new; must be a valid YYMMDD date.
  • D08_SRCE (source code) — validated via valStandard8; must match an approved source lookup value.

Downstream Actions

  • J06 audit — updates ABSD_OVGE.J06_AUTHOR + J06_LNCHDATE for all inserted LRNOs.
  • Staging — refreshes ABSD_FUCA1_UPDATES from inserted (not the base table).
  • Secondary annotation — fires unconditionally; group lookup: Tablename=ABSD_FUCA1, Fieldname=D08_EFD.
ABSD_FUCA2_Update / ABSD_FUCA2_DELETE Table: dbo.ABSD_FUCA2 FOR UPDATE, INSERT Detail rows

Purpose

ABSD_FUCA2 holds per-cargo-type detail rows for a vessel (multiple rows per LRNO). Each row records a stowage mode and commodity combination. The trigger enforces referential integrity against two CBUB1 codebook tables.

Business Rules & Validations

Dual FK Validation — Stowage and Commodity Codes Both FK checks use COLLATE SQL_Latin1_General_CP1_CS_AS for case-sensitive matching — codes differing only in case will fail validation.
FieldRuleCodebook
D08_STOWAGEMust exist in ABSD_CBUB1 where FLDI='01' (stowage modes)CBUB1 Table 01
D08_COMMODITYMust exist in ABSD_CBUB1 where FLDI='02' (commodity types)CBUB1 Table 02

If either FK check fails, the entire transaction is rolled back with an error message.

Downstream Actions

  • J06 audit — writes to ABSD_OVGE for affected LRNOs.
  • Staging — refreshes ABSD_FUCA2_UPDATES from the base table (SELECT * FROM ABSD_FUCA2 WHERE LRNO IN (SELECT LRNO FROM inserted)), not from inserted — captures the full post-update row set.
  • Secondary annotation — fires unconditionally; group lookup: Tablename=ABSD_FUCA2, Fieldname=D08_TOWAGE.
  • ShipWatch — commented-out ABSD_AWSH_UPDATES integration exists but is disabled.

DELETE Trigger

ABSD_FUCA2_DELETE fires unconditionally (no TRIGGER_DISABLE guard) and only writes the J06 audit entry from the deleted pseudo-table.

FUCO1 / FUCO2 – Container Overview

ABSD_FUCO1_Update Table: dbo.ABSD_FUCO1 FOR UPDATE, INSERT Summary row

Purpose

ABSD_FUCO1 holds the single container data overview record per vessel (overall containerisation capability). ABSD_FUCO2 holds the detail rows per container size/type.

Business Rules & Validations

FieldValidatorNotes
D09_EFDvalStandard4_newEffective date — YYMMDD format
D09_SRCEvalStandard8Source code
D09_VERvalStandard1Version/confidence flag

Downstream Actions

  • J06 audit — writes to ABSD_OVGE.
  • Staging — refreshes ABSD_FUCO1_UPDATES from inserted.
  • Secondary annotation — unconditional; group: Tablename=ABSD_FUCO1, Fieldname=D09_EFD.

FUCO2

The detail trigger follows the same delete-only-J06 pattern for FUCO2_DELETE. The update trigger adds validation similar to FUCA2 but for container-type-specific fields.

FUDI1 – Dimensions / Manoeuvring

ABSD_FUDI1_Update Table: dbo.ABSD_FUDI1 FOR UPDATE, INSERT Cursor — redesigned Oct 2007

Purpose

Records vessel dimensions relevant to manoeuvrability: bow thruster diameter, manoeuvring bow length. The trigger was redesigned in October 2007 to use a cursor loop over inserted to support bulk updates (multiple vessels in one statement).

Pre-Cursor Validation (fires once for the whole batch)

FieldRuleCodebook
D22_MAN_TYPFK check — must exist in ABSD_CBUB3 where TABNO='01' (manoeuvrability type codes); case-sensitive joinCBUB3 Table 01

Per-Cursor Validations (per LRNO)

Field(s)Rule
D22_EFDvalStandard4_new — effective date format
D22_VERvalStandard1 — version flag
D22_DD_CC + D22_DIS_DIAMvalStandard3Num — confidence code / thruster discharge diameter pair
Legacy Rules in Old Trigger (now commented out) The original pre-Oct 2007 trigger also enforced:
  • D22_MANBOW_LEN > 0 requires OVTY D01_INT_BASIC to match pattern x3xxx, xx3xx, xxx3x, xxxx3, or xxx6x (vessels with side-entry bow thrusters)
  • Manbow length cross-check against ABSD_HILE C02_LBP (or C02_LOA if LBP < 1): the manbow length must not exceed the vessel's LBP/LOA
  • D22_MBL_CC + D22_MANBOW_LEN via valStandard3Num
These rules were removed in the Oct 2007 cursor redesign — only the D22_MAN_TYP FK check, D22_EFD, D22_VER, and D22_DIS_DIAM validations remain active.

Downstream Actions (per cursor iteration)

  • J06 audit — updates ABSD_OVGE for the current INDEXLRNO.
  • Staging — refreshes ABSD_FUDI1_UPDATES from inserted WHERE LRNO = @INDEXLRNO.
  • Two annotation groups:
    • Fires when D21_efd or D21_srce changes → group: ABSD_FUDI1/D21_efd
    • Fires when D22_srce, D22_dis_diam, D22_efd, D22_man_typ, or D22_manbow_len changes → group: ABSD_FUDI1/D22_srce

FUDI2, FUDI3, FUDI4 Detail Tables

Each has a DELETE trigger (unconditional J06 only) and an UPDATE trigger following the same validation-staging-annotation pattern for their respective dimension fields.

FUDO1 / FUDO2 – Draft & Loadline

ABSD_FUDO1_Update Table: dbo.ABSD_FUDO1 FOR UPDATE, INSERT

Purpose

Records vessel draft, freeboard, and loadline assignment zone data. FUDO1 holds the summary; FUDO2 holds per-loadline zone detail rows.

Pattern

Follows the standard FU* pattern: EFD via valStandard4_new, SRCE via valStandard8, VER via valStandard1, CC fields via valStandard2, CC/value pairs via valStandard3Num. J06 audit, staging refresh from inserted, secondary annotation on the EFD group.

ABSD_FUDO2_DELETE is unconditional J06 only.

FUGE – General Data (Passengers, Crew, Hold Capacities)

ABSD_FUGE_Update Table: dbo.ABSD_FUGE FOR UPDATE, INSERT Cursor — redesigned Aug 2007 SHIP_SEARCH update

Purpose

The most complex cargo trigger. ABSD_FUGE is the central general-data record per vessel, carrying passenger berthing capacities, crew numbers, hold cargo volumes (grain, bale, liquid, gas, oil), number of winches, nuclear power indicator, and auxiliary propulsion indicator. Changes to capacity and passenger fields flow directly into ABSD_SHIP_SEARCH.

Pre-Cursor Digit-Length Validations (batch, fire once)

FieldMax DigitsDescription
D18_WNCHS_NO2Number of deck winches
D06_PASS_UN4Unberthed passenger capacity
D06_PASS_DK4Deck passenger capacity
D06_PASS_BR4Berthed passenger capacity
D06_CREW_NO4Crew number
D06_CBNS4Number of cabins
D06_DVBR4Number of driver berths
D10_GRAIN8Grain capacity (m³ or ft³)
D10_BALE8Bale capacity
D10_INULTD8Insulated cargo capacity
D10_LQD8Liquid cargo capacity (general)
D10_LQG8Liquefied gas capacity
D10_OIL8Oil cargo capacity
D10_SEG_BLLST8Segregated ballast capacity
D10_CLN_BLLST8Clean ballast capacity
D10_VRT_BALE8Vertical bale capacity
D10_OTHER_CAP8Other capacity

Per-Cursor Validations (per LRNO)

Field(s)ValidatorNotes
DOBvalStandard4_newDate of build — YYMMDD
D06_EFDvalStandard4_newPassenger/crew effective date
D06_CCvalStandard2Confidence code
D06_SRCEvalStandard8Source code
D06_PASS_UN_VERvalStandard1Unberthed pax version flag
D06_PASS_DK_VERvalStandard1Deck pax version flag
D06_PASS_BR_VERvalStandard1Berthed pax version flag
D06_PASS_UN + D06_P_UN_CCvalStandard3NumUnberthed pax CC/value pair
D06_CREW_VERvalStandard1Crew version flag
D06_DVBR_VERvalStandard1Driver berth version flag
D10_EFDvalStandard4_newCargo capacity effective date
D10_SRCEvalStandard8Capacity source code
D10_VERvalStandard1Capacity version flag
D10_G_CC / D10_B_CC / D10_I_CC / D10_LQD_CC / D10_LQG_CC / D10_OIL_CC / D10_SB_CC / D10_CB_CC / D10_VB_CC / D10_O_CCvalStandard2Individual capacity confidence codes
D10_HC_VERvalStandard1Hold capacity version flag
D10_HTNG_CLSIN ('C','P','N','U','Y')Heating class — C=Coil, P=Pipe, N=None, U=Unknown, Y=Yes-unspecified. Only validated when not NULL.
D18_EFDvalStandard4_newDeck equipment effective date
D18_CCvalStandard2Deck equipment confidence code
D18_SRCEvalStandard8Deck equipment source code
D18_VERvalStandard1Deck equipment version flag
D18_W_CC + D18_WNCHS_NOvalStandard3NumWinch count CC/value pair
D25_EFDvalStandard4_newSpecial features effective date
D25_CCvalStandard2Special features confidence code
D25_SRCEvalStandard8Special features source code
D25_VERvalStandard1Special features version flag
D25_AUX_PROPIN ('N','U','Y')Auxiliary propulsion indicator. Only validated when not NULL.
D25_NUCLR_PWRIN ('N','U','Y')Nuclear power indicator. Only validated when not NULL.

Cross-Check: Winch Count Requires Electric Lifting Gear

D18_WNCHS_NO Cross-check Against FULI2 When D18_WNCHS_NO > 0, the vessel's lifting gear detail (ABSD_FULI2 for SEQ_NO='01') must have D19_LG_TYP IN ('DE','AF') (electric winch / after-fitted lifting gear). If any FULI2 rows have a different type code, the update is rejected.
IF @PASSEDNUM > 0 AND @PASSEDNUMTWO > 0 -- FULI2 rows with non-electric type
RAISERROR('D18_WNCHS_NO cannot be > 0 unless D19_LG_TYP is DE or AF', 16, 1)

SHIP_SEARCH Update

Capacity and Passenger Fields Flow into ABSD_SHIP_SEARCH When any of the following fields change, the ship search index is immediately updated: D10_LQG, D10_INULTD, D10_LQD, D10_GRAIN, D10_BALE, D06_PASS_BR, D06_PASS_DK, D06_PASS_UN, D10_OIL.
UPDATE ABSD_SHIP_SEARCH SET
  GASCAP      = D10_LQG,
  INSULATEDCAP= D10_INULTD,
  LIQUID      = D10_LQD,
  GRAIN       = D10_GRAIN,
  BALE        = D10_BALE,
  PASSENGERS  = (D06_PASS_DK + D06_PASS_BR + D06_PASS_UN),  -- sum of all three berth types
  OILCAP      = D10_OIL
FROM ABSD_SHIP_SEARCH INNER JOIN INSERTED ON ABSD_SHIP_SEARCH.LRNO = INSERTED.LRNO
WHERE ABSD_SHIP_SEARCH.LRNO = @INDEXLRNO

Secondary Annotation Groups (6 groups)

Trigger ConditionGrouping Lookup Key
D06_CBNS, D06_CREW_NO, D06_DVBR, D06_EFD, D06_PASS_BR, D06_PASS_DK, D06_PASS_UN, D06_SRCEABSD_FUGE / D06_CREW_NO
D10_BALE, D10_CLN_BLLST, D10_EFD, D10_GRAIN, D10_HTNG_CLS, D10_INULTD, D10_LQD, D10_LQG, D10_OIL, D10_OTHER_CAP, D10_OTHER_TYP, D10_SEG_BLLST, D10_SRCE, D10_VRT_BALEABSD_FUGE / D10_BALE
D18_WNCHS_NO, D18_EFD, D18_SRCEABSD_FUGE / D18_WNCHS_NO
D25_EFD, D25_NUCLR_PWR, D25_SRCE, D25_AUX_PROPABSD_FUGE / D25_EFD
DOBABSD_FUGE / DOB
D02_SERVICEABSD_FUGE / D02_Service

FUHA1 / FUHA2 – Hatch Data

ABSD_FUHA1_Update Table: dbo.ABSD_FUHA1 FOR UPDATE, INSERT Summary row

Purpose

Records hatch data summary for a vessel (hatch count, dimensions, cover type). ABSD_FUHA2 holds per-hatch detail rows.

Business Rules & Validations

FieldValidatorNotes
D16_EFDvalStandard4_newEffective date
D16_VERvalStandard1Version flag
D16_CCvalStandard2Confidence code
D16_SRCEvalStandard8Source code

Downstream Actions

  • J06 audit, staging (ABSD_FUHA1_UPDATES from inserted), secondary annotation on D16_EFD group.

FUHA2

ABSD_FUHA2_DELETE is unconditional J06 only. The update trigger validates per-hatch fields and refreshes ABSD_FUHA2_UPDATES.

FULC – Liquid Cargo Capacity

ABSD_FULC_Update Table: dbo.ABSD_FULC FOR UPDATE, INSERT

Purpose

Records liquid cargo capacity in detail (e.g. total liquid cargo capacity with units). Single row per vessel.

Business Rules & Validations

FieldRule
D14_LCAPMax 7 digits (digit-length check via LEN())
D14_EFDvalStandard4_new — effective date
D14_SRCEvalStandard8 — source code
D14_VERvalStandard1 — version flag
D14_LC_CCvalStandard2 — confidence code

Downstream Actions

J06 audit, staging (ABSD_FULC_UPDATES from inserted), secondary annotation on D14_EFD group.

FULI1 / FULI2 / FULI3 – Lifting Gear

ABSD_FULI1_Update Table: dbo.ABSD_FULI1 FOR UPDATE, INSERT Summary row

Purpose

ABSD_FULI1 holds the lifting gear overview record per vessel (total number of cranes, derricks, SWL totals). ABSD_FULI2 and ABSD_FULI3 hold per-piece lifting gear detail. Note: FUGE.D18_WNCHS_NO (winch count) cross-checks FULI2 D19_LG_TYP — see FUGE documentation above.

Business Rules & Validations

FieldValidatorNotes
D19_EFDvalStandard4_newEffective date
D19_SRCEvalStandard8Source code
D19_LIFT_CAP_VERvalStandard1Lifting capacity version flag
D19_LIFT_GEAR_VERvalStandard1Lifting gear version flag
D19_CCvalStandard2Confidence code

Downstream Actions

J06 audit, staging (ABSD_FULI1_UPDATES from inserted), secondary annotation on D19_EFD group.

FULI2 / FULI3 Detail Tables

Both have unconditional DELETE triggers (J06 only) and UPDATE triggers validating per-crane/derrick fields. D19_LG_TYP in FULI2 is constrained to codes in a lifting gear type codebook and is referenced by the FUGE winch count cross-check.

FUOF – Offshore Features

ABSD_FUOF_All Table: dbo.ABSD_FUOF FOR UPDATE, INSERT, DELETE Minimal trigger

Purpose

Records offshore vessel-specific features (e.g. dynamic positioning, deck strength, moonpool). Unusually, all three DML events (UPDATE, INSERT, DELETE) are combined in a single trigger named ABSD_FUOF_All.

Minimal Implementation This trigger contains only a J06 audit update — no field validation, no staging table, no annotation. This may reflect that FUOF data is managed primarily via EDM bulk feeds and manual editing is rare, making detailed validation less critical. The guard check (TRIGGER_DISABLE) is active.

Logic

IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE)
BEGIN
    UPDATE dbo.ABSD_OVGE
    SET J06_AUTHOR = UPPER(LEFT(RIGHT(SYSTEM_USER, ...), 3)),
        J06_LNCHDATE = ...
    WHERE ABSD_OVGE.LRNO IN (
        SELECT LRNO COLLATE Latin1_General_CI_AS FROM inserted
    );
END

Note the use of COLLATE Latin1_General_CI_AS (case-insensitive) on the LRNO join — unlike most FU* triggers which use no explicit collation on the LRNO join.

FURO1 / FURO2 – Roll-on/Roll-off Lane Data

ABSD_FURO1_Update Table: dbo.ABSD_FURO1 FOR UPDATE, INSERT LOA cross-check

Purpose

Records Ro-Ro vessel lane configuration: number of lanes, lane length/width/height, vehicle and lorry capacities. Used for ferry and car carrier data quality.

Digit-Length Validations

FieldMax DigitsDescription
D13_LANES_NO3Number of lanes
D13_LANE_LEN6Total lane length (m)
D13_LANE_CARS5Car capacity
D13_LANE_WAGS5Wagon/railway car capacity
D13_LANE_LOR5Lorry capacity

Format Validations

Field(s)Validator
D13_EFD, D23_EFDvalStandard4_new
D13_SRCE, D23_SRCEvalStandard8
D13_VER, D23_VERvalStandard1
D13_LN_CC + D13_LANES_NOvalStandard3Num
D13_LL1_CC + D13_LANE_LENvalStandard3Num
D13_LW_CC + D13_LANE_WIDvalStandard3Num
D13_LH_CC + D13_LANE_HGTvalStandard3Num Duplicated in source
D13_LC_CC + D13_LANE_CARSvalStandard3Num
D13_WAG_CC + D13_LANE_WAGSvalStandard3Num
D13_LL2_CC + D13_LANE_LORvalStandard3Num
Duplicate Check in Source Code The D13_LH_CC / D13_LANE_HGT validation via valStandard3Num appears twice in the trigger source — this is a copy-paste artefact that has no functional impact (the check is simply run twice).

Cross-Check: Lane Length vs. LOA

D13_LANE_LEN / D13_LANES_NO ≤ C02_LOA When both D13_LANE_LEN > 0 and D13_LANES_NO > 0, the trigger computes the per-lane average length and compares it against the vessel's overall length from ABSD_HILE:
SELECT @PASSEDNUM = D13_LANE_LEN / D13_LANES_NO FROM inserted
SELECT @PASSEDNUMTWO = C02_LOA FROM ABSD_HILE WHERE LRNO IN (SELECT LRNO FROM inserted) AND SEQNO='00'
IF @PASSEDNUM > @PASSEDNUMTWO
    RAISERROR('D13_LANE_LEN / D13_LANES_NO cannot exceed C02_LOA, in this case ' + CAST(@PASSEDNUMTWO AS VARCHAR(8)), 16, 1)

Downstream Actions

  • J06 audit, staging (ABSD_FURO1_UPDATES from inserted).
  • 3 annotation groups: D13_Lane_LEN (on lane length change); D13_Lanes_No (on count/EFD/dimensions changes); D23_EFD (on D23 section changes).

FUSF / FUSF2 – Ship Features / Equipment Codes

ABSD_FUSF_Update Table: dbo.ABSD_FUSF FOR UPDATE, INSERT 15-slot FK validation

Purpose

ABSD_FUSF holds up to 15 ship feature/equipment codes per vessel (e.g. crane type, deck equipment, special facilities). Each code slot is independently validated against the ship features codebook.

Business Rules & Validations

FieldRule
D07_EFDvalStandard4_new — effective date
D07_VERvalStandard1 — version flag
D07_SRCEvalStandard8 — source code
D07_CODE_1 through D07_CODE_15Each slot individually validated against ABSD_CBUB1 where FLDI='12' (ship features). Null slots are skipped — only non-null values are checked.
15-Slot FK Validation Pattern Each of the 15 code slots uses an identical pattern:
IF UPDATE(D07_CODE_N) AND (SELECT COUNT(*) FROM inserted WHERE D07_CODE_N IS NOT NULL) > 0
BEGIN
    IF NOT (SELECT COUNT(*) FROM ABSD_FUSF, ABSD_CBUB1
            WHERE ABSD_FUSF.D07_CODE_N COLLATE SQL_Latin1_General_CP1_CS_AS = ABSD_CBUB1.CODE
              AND ABSD_CBUB1.FLDI = '12'
              AND LRNO IN (SELECT LRNO FROM INSERTED)) > 0
    RAISERROR('The code in D07_CODE_N does not match a record in table 12 of CBUB1', 16, 1)
END
This pattern means a previously filled slot can be cleared to NULL without a codebook check, but setting it to any non-null value (including whitespace) triggers the FK validation.

Downstream Actions

J06 audit, staging (ABSD_FUSF_UPDATES from inserted), secondary annotation on D07_EFD group.

ABSD_FUSF2_DELETE is unconditional J06 only.

FUSP – Ship Particulars

absd_fusp_update Table: dbo.ABSD_FUSP FOR INSERT, UPDATE No validation

Purpose

Records general ship particulars (cumulative capacity, special designations). The trigger is minimal — it contains no field-level validation.

No Field Validation absd_fusp_update performs only J06 audit and secondary annotation. There are no IF UPDATE() validation blocks. This may be intentional for a table managed primarily via automated bulk feeds, or the validations may have been omitted at implementation time. The trigger name is lowercase (unlike all other FU* triggers) which suggests a different author/vintage.

Downstream Actions

  • J06 audit, no staging table refresh.
  • Secondary annotation: group lookup Tablename=ABSD_FUSP, Fieldname=CAP_CUM.

FUSP DELETE Trigger

Unconditional J06 only (no TRIGGER_DISABLE guard).

FUST1 / FUST2 – Cargo Segregation

ABSD_FUST1_Update Table: dbo.ABSD_FUST1 FOR UPDATE, INSERT Cursor — redesigned Aug 2007 Stored procedure validation

Purpose

Records cargo segregation data: how many segregated cargo spaces a vessel has. D12_CARGO_SEG (number of segregated segments) must pass a complex validation routine delegated to a stored procedure.

Business Rules & Validations

FieldValidatorNotes
D12_EFDvalStandard4_newEffective date
D12_SRCEvalStandard8Source code
D12_VERvalStandard1Version flag
D12_CARGO_SEGspValidateD12_CARGO_SEG (stored proc)Returns RETCODE=0 on failure, RETMESSAGE with error text. Called as: exec spValidateD12_CARGO_SEG @INDEXLRNO, '00', 'D12_CARGO_SEG', null, null, @D12_CARGO_SEG, @RETCODE OUTPUT, @RETMESSAGE OUTPUT
Legacy Rule (Old Trigger — Now Commented Out) The original pre-Aug-2007 trigger enforced: D12_CARGO_SEG must be 0 or >1 (value of exactly 1 was forbidden). It also used a direct valStandard3Num check on the D12_CS_CC/D12_CARGO_SEG pair. The current trigger delegates all of this to spValidateD12_CARGO_SEG, which encapsulates the business logic externally.

Downstream Actions

  • J06 audit per cursor iteration.
  • Staging: ABSD_FUST1_UPDATES from inserted WHERE LRNO = @INDEXLRNO.
  • Secondary annotation: group D12_EFD, fires unconditionally per cursor iteration.

FUTO – Anchor & Towing Equipment

FUTO_Insert Table: dbo.ABSD_FUTO FOR INSERT, UPDATE DUAL GUARD Type cross-check

Purpose

Records anchor chain/rope, towing gear, and bollard pull data for vessels — particularly relevant for tugs and offshore support vessels. Has a second guard table TRIGGER_DISABLE_FUTO for bulk anchor data operations.

Guard Structure

IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE)   -- outer: global enable
BEGIN
    IF NOT EXISTS (SELECT * FROM TRIGGER_DISABLE_FUTO)  -- inner: per-operation enable
    BEGIN
        -- all validation and cascade logic
    END
END

Digit-Length Validations

FieldMax DigitsDescription
D20_AT_NO12Anchor type 1 — number of anchors
D20_AT_NO22Anchor type 2 — number of anchors

Format Validations

Field(s)Validator
D20_EFDvalStandard4_new
D20_VERvalStandard1
D20_SRCEvalStandard8
D20_CC, D20_ATS_CC1, D20_ATN_CC1, D20_ATSRL_CC, D20_ATSRD_CC, D20_ATSRS_CC, D20_BP_CCvalStandard2
D20_AT_SWL1 + D20_ATS_CC1valStandard3Num
D20_AT_NO1 + D20_ATN_CC1valStandard3Num
D20_AT_SRLEN + D20_ATSRL_CCvalStandard3Num — stud-link rope length
D20_AT_SRDIAM + D20_ATSRD_CCvalStandard3Num — stud-link rope diameter
D20_AT_SRSWL + D20_ATSRS_CCvalStandard3Num — stud-link rope SWL
D20_BLLRD_PL + D20_BP_CCvalStandard3Num — bollard pull
D20_BLLRD_VERvalStandard1

Cross-Check: Anchor Type Requires Correct Vessel Type

D20_AT_TYP1 ∈ {A,T,C,Y} — Requires Tug or Offshore Vessel Type Anchor/towing type codes A (anchor), T (tug), C (cable), Y (unspecified) are only valid when the vessel's OVTY record indicates a tug or offshore type. The check examines both D01_INT_BASIC and the 5 type slots:
D20_AT_TYP1 IN ('A','T','C','Y')
  AND D01_INT_BASIC NOT LIKE '__4__'        -- not xx4xx (offshore/tug)
  AND D01_TYP_A/B/C/D/E NOT IN ('224')     -- not offshore code 224
→ RAISERROR('D20_AT_TYP1 cannot be A T C or Y unless D01_INT_BASIC is xx4xx or D01_TYP=224')
D20_AT_TYP1 ∈ {N,U} — SWL and Count Must Be Zero When anchor type is N (none) or U (unknown):
  • D20_AT_SWL1 must be 0 (no safe working load without a gear type)
  • D20_AT_NO1 must be 0 (no anchor count without a type)

Cross-Check: Rope Length vs. HIBR Extreme Breadth

D20_AT_SRLEN ≤ C09_EX (Extreme Breadth) Stud-link rope length must not exceed the vessel's extreme breadth from ABSD_HIBR:
SELECT @PASSEDNUMTWO = C09_EX FROM ABSD_HIBR WHERE LRNO IN (SELECT LRNO FROM INSERTED) AND SEQNO='00'
IF @PASSEDNUM > @PASSEDNUMTWO
    RAISERROR('D20_AT_SRLEN must be less than C09_EX, in this case ' + CAST(@PASSEDNUMTWO AS VARCHAR(20)), 16, 1)
D20_AT_SRLEN Offshore Type Check When D20_AT_SRLEN > 1, the vessel must have D01_TYP_A/B/C/D/E = '224' (offshore vessel type). Non-offshore vessels cannot have rope length data.

Removed Rule (Jul 2009)

A previously active check that required D20_BLLRD_PL > 0 only for vessels with D01_INT_BASIC LIKE '__4__' or TYP codes 224, 065, 066, 067, 261, 264, 265, 262 was removed at the request of Michael Ayers on 23/07/2009. The commented-out code remains as documentation.

FK Validation

FieldCodebook
D20_AT_TYP1ABSD_CBUB1 where FLDI='30' (anchor/towing type codes). Note: uses < 1 comparison (less than), unlike the usual NOT > 0 pattern.

Downstream Actions

J06 audit, staging (ABSD_FUTO_UPDATES from inserted), secondary annotation on D20_EFD group.

FUUN1 / FUUN2 – Unit Load (Container TEU)

ABSD_FUUN1_Update Table: dbo.ABSD_FUUN1 FOR UPDATE, INSERT EDM Migration Apr 2026 Location sequence & ordering rules
EDM Migration — April 2026 (GS) Comment at top of trigger: "GS - 29th April 2026: Replaced ABSD_CBUB3 with EDM.DBO.T_REF_CBUB3". The D11_LOC_1/2/3 lookups now use EDM.dbo.T_REF_CBUB3 (the EDM reference table) instead of the local ABSD_CBUB3. This is the second FU* trigger to be EDM-migrated (alongside FUUN1; HIMO was the first machinery trigger in April 2026).

Purpose

Records container/TEU capacity per vessel: total TEU capacity, reefer plug count, and up to three location codes (H=Hold, R=Ramp, D=Deck) indicating where containers can be stowed. The location codes have strict sequential and ordering constraints.

Digit-Length Validations

FieldMax DigitsDescription
D11_TEU_CAP5TEU capacity (max 99999)
D11_REF_CP4Reefer plug count

Format Validations

Field(s)Validator
D11_EFDvalStandard4_new
D11_VERvalStandard1
D11_SRCEvalStandard8
D11_CCvalStandard2
D11_TEU_CAP + D11_TEU_CCvalStandard3Num
D11_TEU_VERvalStandard1
D11_REF_CP + D11_RCP_CCvalStandard3Num

Location Code FK Validation (EDM)

FieldNullable?Codebook
D11_LOC_1Mandatory (always validated)EDM.dbo.T_REF_CBUB3 where TABNO='02' (container location codes)
D11_LOC_2Optional (validated only when not NULL)Same
D11_LOC_3Optional (validated only when not NULL)Same

Location Sequence Constraint

Locations Must Be Filled in Sequence (LOC_1 → LOC_2 → LOC_3) The system enforces that location slots are populated in order — you cannot have LOC_3 without LOC_2, or LOC_2 without LOC_1:
IF D11_LOC_3 IS NOT NULL AND (D11_LOC_2 IS NULL OR D11_LOC_2 IN ('U','Y','N'))
    → ERROR: 'The codes in D11_LOC must be filled in in sequence'
IF D11_LOC_2 IS NOT NULL AND (D11_LOC_1 IS NULL OR D11_LOC_1 IN ('U','N','Y'))
    → ERROR: same

Location Ordering Constraint (H → R → D)

Location Codes Must Follow the H→R→D Hierarchy Container stowage locations must be recorded in order: Hold (H) before Ramp (R) before Deck (D). Arbitrary permutations are rejected. The trigger builds a string of the non-null, non-sentinel location values and checks it against an explicit allowlist:
Permitted single values:   H, R, D
Permitted two-value combos: HH, HR, HD, RR, RD, DD
Permitted three-value combos: HHH, HHR, HRR, HRD, HHD, HDD, RRR, RRD, RDD, DDD
Any combination not in this list (e.g. DHR, RH) is rejected with error 'The codes in D11_LOC must be filled in in order H R D'.

Downstream Actions

  • J06 audit, staging (ABSD_FUUN1_UPDATES from inserted).
  • Conditional annotation group selection (unique pattern among FU* triggers):
    • If D11_REF_CP is being updated → group: ABSD_FUUN1/D11_REF_CP
    • Else if D11_TEU_CAP is being updated → group: ABSD_FUUN1/D11_TEU_CAP
    • Else → group: ABSD_FUUN1/D11_EFD
    This ensures the annotation is logged under the most relevant grouping category for the type of change.

FUUN2

ABSD_FUUN2_DELETE is unconditional J06 only. The ABSD_FUUN2_Update trigger validates per-container-type unit load fields.

Cross-Reference: FU* Triggers Summary

Table Trigger(s) Purpose Key Rules SHIP_SEARCH Staging Table EDM
ABSD_FUCA1 FUCA1_Update Cargo capacity summary D08_EFD, D08_SRCE No FUCA1_UPDATES (inserted) No
ABSD_FUCA2 FUCA2_Update, FUCA2_DELETE Cargo capacity detail D08_STOWAGE→CBUB1[01], D08_COMMODITY→CBUB1[02] No FUCA2_UPDATES (base table) No
ABSD_FUCO1 FUCO1_Update Container overview D09_EFD, D09_SRCE, D09_VER No FUCO1_UPDATES (inserted) No
ABSD_FUCO2 FUCO2_Update, FUCO2_DELETE Container detail Standard format checks No FUCO2_UPDATES No
ABSD_FUDI1 FUDI1_Update (cursor) Dimensions/manoeuvrability D22_MAN_TYP→CBUB3[01]; D22_DIS_DIAM CC pair; 2 anno groups No FUDI1_UPDATES (inserted) No
ABSD_FUDI2/3/4 Update + DELETE per table Dimension detail rows Standard format checks No Per-table UPDATES No
ABSD_FUDO1/2 Update + DELETE per table Draft/loadline Standard format checks + CC pairs No Per-table UPDATES No
ABSD_FUGE FUGE_Update (cursor) General data — pax/crew/hold caps 17 capacity fields; D18_WNCHS_NO cross-check FULI2; HTNG_CLS enum; AUX_PROP enum; 6 anno groups Yes: GRAIN, BALE, LIQUID, GASCAP, INSULATEDCAP, OILCAP, PASSENGERS FUGE_UPDATES (inserted) No
ABSD_FUHA1 FUHA1_Update Hatch overview D16_EFD, CC, SRCE, VER No FUHA1_UPDATES (inserted) No
ABSD_FUHA2 FUHA2_Update, FUHA2_DELETE Hatch detail Per-hatch field checks No FUHA2_UPDATES No
ABSD_FULC FULC_Update Liquid cargo capacity D14_LCAP max 7 digits; EFD, SRCE, VER, CC No FULC_UPDATES (inserted) No
ABSD_FULI1 FULI1_Update Lifting gear overview EFD, two VER flags, SRCE, CC No FULI1_UPDATES (inserted) No
ABSD_FULI2/3 Update + DELETE per table Lifting gear detail D19_LG_TYP referenced by FUGE winch check No Per-table UPDATES No
ABSD_FUOF FUOF_All (UPDATE+INSERT+DELETE) Offshore features J06 only; no validation No None No
ABSD_FURO1 FURO1_Update Ro-Ro lane data Lane dims; CC pairs; LOA cross-check; 3 anno groups; duplicate D13_LH_CC check No FURO1_UPDATES (inserted) No
ABSD_FURO2 FURO2_Update, FURO2_DELETE Ro-Ro detail Standard format checks No FURO2_UPDATES No
ABSD_FUSF FUSF_Update Ship features codes 15 code slots → CBUB1[12]; null slots skipped No FUSF_UPDATES (inserted) No
ABSD_FUSF2 FUSF2_Update, FUSF2_DELETE Ship features detail Standard format checks No FUSF2_UPDATES No
ABSD_FUSP absd_fusp_update, FUSP_DELETE Ship particulars No validation; J06 + annotation only No None No
ABSD_FUST1 FUST1_Update (cursor) Cargo segregation D12_CARGO_SEG → spValidateD12_CARGO_SEG No FUST1_UPDATES (inserted) No
ABSD_FUST2 FUST2_Update, FUST2_DELETE Cargo segregation detail Standard format checks No FUST2_UPDATES No
ABSD_FUTO FUTO_Insert (dual guard) Anchor/towing equipment AT_TYP→CBUB1[30]; N/U type requires SWL=0 and count=0; A/T/C/Y type requires tug/offshore type; rope len ≤ HIBR breadth; rope len requires TYP='224' No FUTO_UPDATES (inserted) No
ABSD_FUUN1 FUUN1_Update Unit load (TEU/container) TEU max 5 digits; LOC_1/2/3 → EDM.T_REF_CBUB3[02]; sequence rule; H→R→D order rule; conditional annotation No FUUN1_UPDATES (inserted) Yes (Apr 2026)
ABSD_FUUN2 FUUN2_Update, FUUN2_DELETE Unit load detail Per-container-type field checks No FUUN2_UPDATES No

Architectural Notes

Header / Detail Table Pattern

The FU* series consistently uses a header + detail split: the 1-suffix table (FUCA1, FUCO1, etc.) holds a single summary row per vessel with aggregate totals and provenance metadata (EFD, SRCE, VER, CC). The 2/3/4-suffix tables hold per-item detail rows. Header triggers carry the bulk of validation logic; detail triggers apply FK lookups and simpler checks.

Delete Trigger Design

All DELETE triggers on detail tables fire unconditionally (no TRIGGER_DISABLE guard check) and contain only a J06 audit update using the deleted pseudo-table. This ensures that deletions are always audited even when triggers are administratively disabled for bulk operations.

Staging Table Variants

Two staging refresh patterns coexist in the FU* series:

Cursor Usage

Three FU* triggers were redesigned with cursor loops: FUDI1 (Oct 2007), FUGE (Aug 2007), FUST1 (Aug 2007). All use DECLARE ... INSENSITIVE CURSOR FOR SELECT LRNO FROM inserted — the INSENSITIVE keyword takes a static snapshot, preventing cursor-internal modifications from affecting the result set. The cursor pattern was introduced to support scenarios where a single UPDATE statement touches multiple LRNOs (batch operations from the electronic data feed).

SHIP_SEARCH Integration

Only ABSD_FUGE writes to ABSD_SHIP_SEARCH in the cargo trigger series. The update fires within the cursor loop and covers the 7 most commercially important capacity metrics: grain, bale, liquid, gas, insulated, oil capacities, and total passengers (sum of all three berth types). All other FU* tables do not update SHIP_SEARCH — structural data (dimensions, hatch counts, Ro-Ro lanes) is not surfaced in the public search index.

EDM Migration Progress (May 2026)

Only ABSD_FUUN1 has been migrated to the EDM reference database. Its D11_LOC_1/2/3 FK lookups now query EDM.dbo.T_REF_CBUB3 instead of the local ABSD_CBUB3. All other cargo triggers still use local ABSD_CBUB1 and ABSD_CBUB3 tables for FK validation. The migration of remaining cargo codebook references is pending.

Commented-Out ShipWatch Integration

Multiple triggers (FUCA2, FURO1, FUSF, FUTO) contain commented-out blocks for updating ABSD_AWSH_UPDATES (ShipWatch analytics staging). These were never activated and represent a planned-but-unrealised integration with the ShipWatch reporting pipeline.