Stored Procedures & Views Reference
Key stored procedures (1,029 total) and views (1,498 total). Covers the GROUP_FLEET fleet hierarchy batch pipeline, compliance sync, audit logging, and the full view layer from raw ABSD_ tables to the VSL_ output family.
ABSD_GROUP_FLEET and its working tables (work_owners, work_wsg). They run as a scheduled batch — NOT triggered by row changes. All 7 procedures run in sequence.Builds the initial work_wsg table with 3-level fleet hierarchies using three nested cursor operations.
- c_parent cursor: Finds top-level parent groups (
ABSD_OWGE.group_owge='A') with active ships having principal/part-owner relationships - c_level1 cursor: Finds management companies (
group_owge='M'or'B') under the parent groups - c_level2 cursor: Finds 2-level deep hierarchies (M company under another M, with B-level ships)
| Detail | Value |
|---|---|
| Active ship filter | ABSD_HIST.a02_sts IN ('S','L','R','T','C','V','P','O','U','F','E') |
| Ownership codes included | 'DO' Direct Owner, 'RC' Related Company, 'BO' Beneficial Owner, 'AS' Associated |
| Visibility filter | Only entities with publind_1='P' (Public) inserted |
| Tables read | ABSD_HIST, ABSD_OWSH, ABSD_OWGE, ABSD_OWXR |
| Tables written | work_wsg |
Enriches work_wsg with EFD (Effective From Date) values. Priority lookup: ABSD_HIPP (principal) → ABSD_HIOW (owner) → ABSD_HISM (ship manager). All at seqno='00'. Only updates if EFD found and not NULL.
Populates fleet_manager_efd in work_owners. Priority: ABSD_HISM → ABSD_HIOW → ABSD_HIPP. Filters out EFD '198099' (null sentinel).
Populates disponent_owner_efd — the commercial/chartering party's effective date. Same lookup hierarchy as fleet_update (HISM → HIOW → HIPP).
Propagates EFD across ownership roles. If the same entity code appears in multiple roles and one has an EFD but the other does not, the known EFD is copied across.
Fills missing fleet_manager_efd and group_owner_efd using regd_owner_efd as default when manager/owner exist but EFD is null.
Eliminates duplicate rows in work_owners when the same LRNO appears multiple times. Deduplication priority per LRNO:
- Look up registered owner from
ABSD_OWSH(Direct Owner relationship) - From the registered owner, look up parent group from
ABSD_OWXR(Beneficial Owner'BO') - If no BO found, look up group from
ABSD_OWGEwheretitle1='BO'andgroup_owge='A' - Fallback: use
h03_ppc(principal performance controller fromABSD_HIPP) - Updates current row's group_owner; deletes previous duplicate row
XACT_ABORT ON with BEGIN TRAN / COMMIT and rollback on error.| Step | Logic | Tables |
|---|---|---|
| 1. Change Detection | Uses EXCEPT clause to identify records in ABSD_SHIP_SEARCH_WORKING that differ from ABSD_SHIP_SEARCH across 73+ compliance fields (sanctions, port calls, beneficial owner, flags, PSC records, etc.) | ABSD_SHIP_SEARCH, ABSD_SHIP_SEARCH_WORKING |
| 2. Audit Trail | For each changed record, inserts into tblLEGAL_OVERALL_History with old LEGAL_OVERALL value and all compliance field values | tblLEGAL_OVERALL_History |
| 3. Launch Date Filter | For newly launched ships (J06_LNCHDATE > GETDATE()-1), applies full compliance data; otherwise applies defaults/nulls | ABSD_OVGE |
| 4. Table Update | Bulk updates ABSD_SHIP_SEARCH from working table for all changed fields | ABSD_SHIP_SEARCH |
| 5. LEGAL2 Frozen | WHERE LEGAL2_NOTUPDATED=1, copies LEGAL2_* fields from working table without recalculation | ABSD_SHIP_SEARCH |
| 6. LEGAL2 Calculation | For non-frozen records, derives LEGAL2_* fields from vwLEGAL2_INTS view | vwLEGAL2_INTS |
| 7. ISO2 Geographic | Maps 20+ country code fields to ISO2 via vwCountryDecode (build country, owner country, flag, operator country, etc.) | vwCountryDecode |
| 8. Flexible Fields | Populates EEXI, ALTERNATIVE_DWT, ALTERNATIVE_DRAUGHT from tblFlexible_Bucket | tblFlexible_Bucket |
| 9. J06 Update | Sets J06_LNCHDATE/J06_LNCHTIME in ABSD_OVGE for all changed records | ABSD_OVGE |
Parameters: @Tablename, @Fieldname, @IDNo (LRNO/OWCODE), @IDFieldname, @IsNew (bit), @NewValue, @OldValue, @Initials, @Source, @SourceRef, @FilingRef, @ExtraData
- Calls
spGetEnglishFieldNameto translate column name to human-readable field name - Special handling for Name fields: marks as
'New Name'or'Name should be' - Handles quote escaping in values (
'→'') - Constructs and executes dynamic SQL INSERT into
tblChanges
Maintains the relationship between LR class status and special feature codes in ABSD_FUSF2.
| Parameter Value | Action | Feature Codes Affected |
|---|---|---|
'W' — disclassed | Calls spDeleteFUSF2 for each code | 0554, 0539, 0527, 0551, 0538 |
'Y' — classed | Reads vwLRClassNotationMining for applicable notation codes; calls spCreateNewFUSF2 for each | Per vwLRClassNotationMining result |
Generates formatted amendment notices for company address changes and appends them to ABSD_OWAN (owner annotations).
- Check if address has care-of company reference (COCODE): if yes use
ABSD_OWIN, if no useABSD_OWAD1 - Construct formatted notice with PO Box, street, postcode, town, country, phone, fax, telex, email, web — with CR/LF line breaks
- Decode street/town/country codes via
vwStreetDecode,vwTownDecode,vwCountryDecode - If existing note has space (<1600 chars): append; if note is full: create new note sequence in
ABSD_OWAN
| Procedure | Purpose | Key Detail |
|---|---|---|
spAddUserPermissions(@User) |
Database Permission Grant | Iterates all sysobjects: SPs get GRANT EXECUTE; tables/views get GRANT SELECT, INSERT, UPDATE, DELETE. Executes dynamic GRANT SQL per object. |
spABSD_AUX_ENGINES_SNAPSHOT |
Engine Point-in-Time Snapshot | Truncates ABSD_AUX_ENGINES_SNAPSHOT and inserts all current ABSD_AUX_ENGINES records for change detection comparison. |
spABSD_AUX_ENGINES_LUPD |
Engine Change Timestamp | Updates ABSD_OVGE.J06_LNCHDATE and J06_LNCHTIME for all vessels appearing in ABSD_AUX_ENGINES_COMPARISON (the change delta table). Transaction with rollback. |
SearchAllTables(@SearchStr) |
Full-Text Data Search | Iterates ALL base tables and ALL string columns executing LIKE queries. Returns table.column and matching value (max 3,630 chars per match). Used for data discovery, lineage investigation, and compliance auditing. |
The most comprehensive fleet view. Joins ABSD_OVGE (base) to all current-record history tables via SEQNO='00'. SEQNO joins are INNER JOINs; ownership company joins are LEFT JOINs.
| Joined Table | Purpose | Join Condition |
|---|---|---|
ABSD_OVNA | Vessel name | SEQNO='00', INNER |
ABSD_HIFL | Flag | SEQNO='00', INNER |
ABSD_HITL | Tonnage | SEQNO='00', INNER |
ABSD_HIST | Status | SEQNO='00', INNER |
ABSD_HIMA | Manager | SEQNO='00', INNER |
ABSD_HIOW | Registered owner | SEQNO='00', INNER |
ABSD_HIPP | Parent company | SEQNO='00', INNER |
ABSD_HISM | Ship manager | SEQNO='00', INNER |
ABSD_HIOP | Operator | SEQNO='00', INNER |
ABSD_TECH_MAN | Technical manager | SEQNO='00', INNER |
ABSD_OVDOC | DOC company | SEQNO='00', INNER |
5 × ABSD_OWGE aliases | One per ownership role | LEFT JOIN |
2 × ABSD_OWSH aliases | Manager & owner relationships | LEFT JOIN |
ABSD_CBUB1 (FLDI='19') | Status decode | LEFT JOIN |
tblStatCode5 | Ship type decode | LEFT JOIN |
Filter criteria: B07_GROSS >= 299 AND A02_STS IN ('P','O','U','F','E','S','C','R','L','T','J','V') (excludes 'K') OR status changed within last 12 months.
Joins ABSD_OVGE to ABSD_HIPP, ABSD_HIOW, ABSD_HISM, ABSD_HIOP, ABSD_OVSMC, ABSD_HITL, ABSD_HIST — all at SEQNO='00'.
Prioritizes EDM data; falls back to ABSD_ for unmigrated entities only.
Cross-reference view using EDM for relationship data where available, with ABSD_OWXR as fallback. Used in the HIOW trigger for beneficial owner resolution.
Single-table lookup returning OWCODE → short name. Replaces ABSD_OWGE in most current views. The LTRIM is for performance.
| Table / View | Purpose | Join Type |
|---|---|---|
ABSD_CAGE1 | Base incident record | Base |
vwCasualtyLDT | Casualty primary data | RIGHT OUTER JOIN |
ABSD_HIST SEQNO='00' | Current vessel status | JOIN |
vwCountryDecode | Flag country decode | JOIN |
ABSD_CALA | Location detail | JOIN |
ABSD_CBUB1 (FLDI='19') | Status decode | JOIN |
ABSD_OVNA | Vessel name history | JOIN |
ABSD_HIOW SEQNO='00' | Current owner | JOIN |
ABSD_CBSD.INBAS_SUB | Ship type decode | JOIN |
tblStarsCas | Casualty star rating | JOIN |
vwCasualtyDemolitionDate | Demolition date | LEFT JOIN |
vwTownDecodeFullCode | Breaker location decode | JOIN |
ABSD_CADI | Disposal information | RIGHT OUTER JOIN |
tblMasterShipTypeXref | Ship type cross-reference | LEFT JOIN |
DISP decode: CASE on DISP field: C=Casualty, D=Demolition, X=Both.
Identifies ownership at the time of the casualty, not current ownership:
| View | Source | Purpose |
|---|---|---|
vwCountryDecode | EDM.dbo.T_REF_COUNTRY | Returns COUNTRY_CODE, SHORT_NAME, LONG_NAME, ISO2 |
vwFlagDecode | EDM.dbo.T_REF_COUNTRY | Same source, filtered to active non-special-territory flag states |
vwExFlag | ABSD_HIFL + EDM.dbo.T_REF_COUNTRY | Previous flag — first non-current SEQNO per vessel. Uses MIN(SEQNO) WHERE SEQNO <> '00' per LRNO. |
Current (active) foreign classification society assignments only.
PIVOT transformation on ABSD_FUSF2 D07_CODE column. Pivots ice class notation codes (FS1A, FS1B, FS1C, FS1S, FSII, 3019, 4001) into separate boolean columns per vessel.
SEQNO='00' and join to vwCOCODE for the company name. Most have a companion *History view (WHERE SEQNO <> '00') returning all non-current records.| View | Source Table | Company Code Field |
|---|---|---|
vwABSD_HIOWCurrent | ABSD_HIOW | H01_OWNER_CODE |
vwABSD_HISMCurrent | ABSD_HISM | SHIPMANAGER |
vwABSD_HIOPCurrent | ABSD_HIOP | OPERATOR_CODE |
vwABSD_HIPPCurrent | ABSD_HIPP | H03_PPC |
vwABSD_HIGBOCurrent | ABSD_HIGBO | GBO_CODE |
vwABSD_HIMALCurrent | ABSD_HIMA | H02_MANAGER |
vwABSD_HIBBCCurrent | ABSD_HIBBC | BBC_CODE |
vwABSD_OVSMCCurrent | ABSD_OVSMC | OWCODE |
vwABSD_OVDOCCurrent | ABSD_OVDOC | OWCODE |
vwABSD_Tech_ManCurrent | ABSD_TECH_MAN | OWCODE |
vwABSD_HISTCurrent | ABSD_HIST | (no company join) |
vwABSD_HIFLCurrent | ABSD_HIFL | (country join) |
vwABSD_HITLCurrent | ABSD_HITL | (no company join) |
vwABSD_HIBRCurrent | ABSD_HIBR | (builder join) |
VSLD.Imo_num = OVG.LRNO equates IMO_NUM and LRNO. This is the primary bridge between VSL_ and ABSD_ families. See also the implicit relationship model below.ITC-69 tonnage is preferred over national tonnage in the COALESCE logic.
| Parent Table | Child Table | Join Condition | Relationship |
|---|---|---|---|
ABSD_OVGE | ABSD_OVNA | LRNO = LRNO | 1:many — vessel → name history |
ABSD_OVGE | ABSD_HIOW | LRNO = LRNO, SEQNO | 1:many — vessel → owner history |
ABSD_OVGE | ABSD_HIMA | LRNO = LRNO, SEQNO | 1:many — vessel → manager history |
ABSD_OVGE | ABSD_HISM | LRNO = LRNO, SEQNO | 1:many — vessel → ship manager |
ABSD_OVGE | ABSD_HIOP | LRNO = LRNO, SEQNO | 1:many — vessel → operator |
ABSD_OVGE | ABSD_HIPP | LRNO = LRNO, SEQNO | 1:many — vessel → parent company |
ABSD_OVGE | ABSD_HIFL | LRNO = LRNO, SEQNO | 1:many — vessel → flag history |
ABSD_OVGE | ABSD_HITL | LRNO = LRNO, SEQNO | 1:many — vessel → tonnage history |
ABSD_OVGE | ABSD_HIST | LRNO = LRNO, SEQNO | 1:many — vessel → status history |
ABSD_OVGE | ABSD_HIFC1 | LRNO = LRNO, SEQNO | 1:many — vessel → classification |
ABSD_OVGE | ABSD_HIBBC | LRNO = LRNO, SEQNO | 1:many — vessel → bareboat charterer |
ABSD_OVGE | ABSD_HIGBO | LRNO = LRNO, SEQNO | 1:many — vessel → group owner |
ABSD_OVGE | ABSD_STSE | LRNO = LRNO, SEQNO | 1:many — vessel → build records |
ABSD_OVGE | ABSD_CAGE1 | LRNO = LRNO | 1:many — vessel → incidents |
ABSD_OVGE | ABSD_FUGE | LRNO = LRNO | 1:1 — vessel → capacity |
ABSD_OVGE | ABSD_TANKER | LRNO = LRNO | 1:1 — vessel → tanker details |
ABSD_OVGE | ABSD_GROUP_FLEET | LRNO = LRNO | 1:1 — vessel → fleet grouping |
ABSD_OVGE | VSL_DESIGNATION | LRNO = IMO_NUM | 1:1 — LRNO equals IMO number |
ABSD_HIOW | ABSD_OWGE | H01_OWNER_CODE = OWCODE | many:1 — owner records → company |
ABSD_HIMA | ABSD_OWGE | H02_MANAGER = OWCODE | many:1 — manager records → company |
ABSD_HISM | ABSD_OWGE | SHIPMANAGER = OWCODE | many:1 |
ABSD_HIOP | ABSD_OWGE | OPERATOR_CODE = OWCODE | many:1 |
ABSD_HIPP | ABSD_OWGE | H03_PPC = OWCODE | many:1 |
ABSD_OWGE | ABSD_OWXR | OWCODE = OWCODE | 1:many — company → relationships |
ABSD_OWGE | ABSD_OWSH | OWCODE = OWCODE | 1:many — company → ship links |
ABSD_OWGE | ABSD_OWNA | OWCODE = OWCODE | 1:many — company → name history |
ABSD_CAGE1 | ABSD_CADI | LRNO+INNO = LRNO+INNO | 1:1 — incident → disposal detail |
ABSD_CAGE1 | ABSD_CALA | LRNO+INNO = LRNO+INNO | 1:1 — incident → location |
ABSD_CBPPROOT | ABSD_CBPD | country+town = country+town | 1:1 — port root → port details |
ABSD_CBPPROOT | ABSD_CBTO1 | country+town = country+town | 1:1 — port root → town master |
ABSD_CBCOROOT | ABSD_CBCONAME | OWCODE = OWCODE | 1:many — company → names |
ABSD_CBCOROOT | ABSD_CBCOADDR | OWCODE = OWCODE | 1:many — company → addresses |
ABSD_CBCOROOT | ABSD_CBCOCOMM | OWCODE = OWCODE | 1:many — company → communications |