06 — Procedures & Views

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.

1,029
Stored Procs
1,498
Views
7
GROUP_FLEET Procs
28
Implicit Joins
Procedures GROUP_FLEET Suite — Fleet Hierarchy Management
The sp_GROUP_FLEET_* procedures maintain 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.
sp_GROUP_FLEET_p_wsg — Build Working Ship Group Table

Builds the initial work_wsg table with 3-level fleet hierarchies using three nested cursor operations.

  1. c_parent cursor: Finds top-level parent groups (ABSD_OWGE.group_owge='A') with active ships having principal/part-owner relationships
  2. c_level1 cursor: Finds management companies (group_owge='M' or 'B') under the parent groups
  3. c_level2 cursor: Finds 2-level deep hierarchies (M company under another M, with B-level ships)
DetailValue
Active ship filterABSD_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 filterOnly entities with publind_1='P' (Public) inserted
Tables readABSD_HIST, ABSD_OWSH, ABSD_OWGE, ABSD_OWXR
Tables writtenwork_wsg
sp_GROUP_FLEET_p_wsg_update — Enrich EFD Values

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.

sp_GROUP_FLEET_p_fleet_update — Fleet Manager EFD

Populates fleet_manager_efd in work_owners. Priority: ABSD_HISMABSD_HIOWABSD_HIPP. Filters out EFD '198099' (null sentinel).

sp_GROUP_FLEET_p_dispow_update — Disponent Owner EFD

Populates disponent_owner_efd — the commercial/chartering party's effective date. Same lookup hierarchy as fleet_update (HISM → HIOW → HIPP).

sp_GROUP_FLEET_p_date_update — Cross-Role EFD Propagation

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.

sp_GROUP_FLEET_p_date1_update — Fallback EFD Fill

Fills missing fleet_manager_efd and group_owner_efd using regd_owner_efd as default when manager/owner exist but EFD is null.

sp_GROUP_FLEET_remove_groups_dups — Deduplication

Eliminates duplicate rows in work_owners when the same LRNO appears multiple times. Deduplication priority per LRNO:

  1. Look up registered owner from ABSD_OWSH (Direct Owner relationship)
  2. From the registered owner, look up parent group from ABSD_OWXR (Beneficial Owner 'BO')
  3. If no BO found, look up group from ABSD_OWGE where title1='BO' and group_owge='A'
  4. Fallback: use h03_ppc (principal performance controller from ABSD_HIPP)
  5. Updates current row's group_owner; deletes previous duplicate row
Procedure spABSD_SHIP_SEARCH_SYNC — Compliance Data Synchronization
Central compliance procedure. Synchronizes all legal/compliance/sanctions data from the working table to the live search index, with full audit trail. Runs under XACT_ABORT ON with BEGIN TRAN / COMMIT and rollback on error.
StepLogicTables
1. Change DetectionUses 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 TrailFor each changed record, inserts into tblLEGAL_OVERALL_History with old LEGAL_OVERALL value and all compliance field valuestblLEGAL_OVERALL_History
3. Launch Date FilterFor newly launched ships (J06_LNCHDATE > GETDATE()-1), applies full compliance data; otherwise applies defaults/nullsABSD_OVGE
4. Table UpdateBulk updates ABSD_SHIP_SEARCH from working table for all changed fieldsABSD_SHIP_SEARCH
5. LEGAL2 FrozenWHERE LEGAL2_NOTUPDATED=1, copies LEGAL2_* fields from working table without recalculationABSD_SHIP_SEARCH
6. LEGAL2 CalculationFor non-frozen records, derives LEGAL2_* fields from vwLEGAL2_INTS viewvwLEGAL2_INTS
7. ISO2 GeographicMaps 20+ country code fields to ISO2 via vwCountryDecode (build country, owner country, flag, operator country, etc.)vwCountryDecode
8. Flexible FieldsPopulates EEXI, ALTERNATIVE_DWT, ALTERNATIVE_DRAUGHT from tblFlexible_BuckettblFlexible_Bucket
9. J06 UpdateSets J06_LNCHDATE/J06_LNCHTIME in ABSD_OVGE for all changed recordsABSD_OVGE
Procedure spAnnotateChange — Audit Log Writer
spAnnotateChange — called by nearly every trigger when key fields change

Parameters: @Tablename, @Fieldname, @IDNo (LRNO/OWCODE), @IDFieldname, @IsNew (bit), @NewValue, @OldValue, @Initials, @Source, @SourceRef, @FilingRef, @ExtraData

  • Calls spGetEnglishFieldName to 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
Procedure spAddDeleteFUSF2 — Class Notation Feature Management
spAddDeleteFUSF2(@PASSEDLRCLIND, @PASSEDINDEXLRNO)

Maintains the relationship between LR class status and special feature codes in ABSD_FUSF2.

Parameter ValueActionFeature Codes Affected
'W' — disclassedCalls spDeleteFUSF2 for each code0554, 0539, 0527, 0551, 0538
'Y' — classedReads vwLRClassNotationMining for applicable notation codes; calls spCreateNewFUSF2 for eachPer vwLRClassNotationMining result
Procedure spAddressTRF — Address Amendment Notice Generator
spAddressTRF(@OWCODE, @SEQNO)

Generates formatted amendment notices for company address changes and appends them to ABSD_OWAN (owner annotations).

  1. Check if address has care-of company reference (COCODE): if yes use ABSD_OWIN, if no use ABSD_OWAD1
  2. Construct formatted notice with PO Box, street, postcode, town, country, phone, fax, telex, email, web — with CR/LF line breaks
  3. Decode street/town/country codes via vwStreetDecode, vwTownDecode, vwCountryDecode
  4. If existing note has space (<1600 chars): append; if note is full: create new note sequence in ABSD_OWAN
Procedures Utility & Maintenance Procedures
ProcedurePurposeKey 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.
Views Ownership & Fleet Views
vwFleetDetails — Comprehensive Fleet View (15-table join)

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 TablePurposeJoin Condition
ABSD_OVNAVessel nameSEQNO='00', INNER
ABSD_HIFLFlagSEQNO='00', INNER
ABSD_HITLTonnageSEQNO='00', INNER
ABSD_HISTStatusSEQNO='00', INNER
ABSD_HIMAManagerSEQNO='00', INNER
ABSD_HIOWRegistered ownerSEQNO='00', INNER
ABSD_HIPPParent companySEQNO='00', INNER
ABSD_HISMShip managerSEQNO='00', INNER
ABSD_HIOPOperatorSEQNO='00', INNER
ABSD_TECH_MANTechnical managerSEQNO='00', INNER
ABSD_OVDOCDOC companySEQNO='00', INNER
5 × ABSD_OWGE aliasesOne per ownership roleLEFT JOIN
2 × ABSD_OWSH aliasesManager & owner relationshipsLEFT JOIN
ABSD_CBUB1 (FLDI='19')Status decodeLEFT JOIN
tblStatCode5Ship type decodeLEFT JOIN
vwISROwnerSelection — Significant Ships with Full Ownership Chain

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'.

vwABSD_OWGE_EDM — Integrated Owner Master (Dual Source)

Prioritizes EDM data; falls back to ABSD_ for unmigrated entities only.

SELECT ... FROM EDM.dbo.T_ENT_MASTER M JOIN EDM.dbo.T_ENT_ADDRESS A ON M.EDM_ENT_ID = A.EDM_ENT_ID WHERE A.IS_BEST_ADDRESS=1 AND IS_ACTIVE=1 UNION ALL SELECT ... FROM ABSD_OWGE LEFT JOIN EDM.dbo.T_ENT_MASTER ON ABSD_OWGE.OWCODE = EDM.OWCODE WHERE EDM.OWCODE IS NULL -- only unmigrated legacy records
vwABSD_OWXR_EDM — Owner Relationship View

Cross-reference view using EDM for relationship data where available, with ABSD_OWXR as fallback. Used in the HIOW trigger for beneficial owner resolution.

vwCOCODE — Fast Owner Code Lookup
SELECT OWCODE, LTRIM(SHNAME) AS SHNAME FROM EDM.dbo.T_ENT_OWGE

Single-table lookup returning OWCODE → short name. Replaces ABSD_OWGE in most current views. The LTRIM is for performance.

Views Casualty Views
vwCasualty — Comprehensive Casualty View
Table / ViewPurposeJoin Type
ABSD_CAGE1Base incident recordBase
vwCasualtyLDTCasualty primary dataRIGHT OUTER JOIN
ABSD_HIST SEQNO='00'Current vessel statusJOIN
vwCountryDecodeFlag country decodeJOIN
ABSD_CALALocation detailJOIN
ABSD_CBUB1 (FLDI='19')Status decodeJOIN
ABSD_OVNAVessel name historyJOIN
ABSD_HIOW SEQNO='00'Current ownerJOIN
ABSD_CBSD.INBAS_SUBShip type decodeJOIN
tblStarsCasCasualty star ratingJOIN
vwCasualtyDemolitionDateDemolition dateLEFT JOIN
vwTownDecodeFullCodeBreaker location decodeJOIN
ABSD_CADIDisposal informationRIGHT OUTER JOIN
tblMasterShipTypeXrefShip type cross-referenceLEFT JOIN

DISP decode: CASE on DISP field: C=Casualty, D=Demolition, X=Both.

vwCasualtyIncidentRegOwner / Operator / GroupOwner — Point-in-Time Ownership

Identifies ownership at the time of the casualty, not current ownership:

SELECT ..., dbo.fnGetRegOwnerAtDate(LRNO, STD) AS owner_at_incident FROM ABSD_CAGE1
Views Reference / Decode Views
ViewSourcePurpose
vwCountryDecodeEDM.dbo.T_REF_COUNTRYReturns COUNTRY_CODE, SHORT_NAME, LONG_NAME, ISO2
vwFlagDecodeEDM.dbo.T_REF_COUNTRYSame source, filtered to active non-special-territory flag states
vwExFlagABSD_HIFL + EDM.dbo.T_REF_COUNTRYPrevious flag — first non-current SEQNO per vessel. Uses MIN(SEQNO) WHERE SEQNO <> '00' per LRNO.
Views Classification Views
vwABSD_FOR_CLASSCurrent
SELECT * FROM ABSD_FOR_CLASS WHERE new_seq = '00'

Current (active) foreign classification society assignments only.

vwIceClass — Ice Class PIVOT

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.

Views Standard "Current" Views Pattern
Pattern: All views below filter the corresponding history table to SEQNO='00' and join to vwCOCODE for the company name. Most have a companion *History view (WHERE SEQNO <> '00') returning all non-current records.
ViewSource TableCompany Code Field
vwABSD_HIOWCurrentABSD_HIOWH01_OWNER_CODE
vwABSD_HISMCurrentABSD_HISMSHIPMANAGER
vwABSD_HIOPCurrentABSD_HIOPOPERATOR_CODE
vwABSD_HIPPCurrentABSD_HIPPH03_PPC
vwABSD_HIGBOCurrentABSD_HIGBOGBO_CODE
vwABSD_HIMALCurrentABSD_HIMAH02_MANAGER
vwABSD_HIBBCCurrentABSD_HIBBCBBC_CODE
vwABSD_OVSMCCurrentABSD_OVSMCOWCODE
vwABSD_OVDOCCurrentABSD_OVDOCOWCODE
vwABSD_Tech_ManCurrentABSD_TECH_MANOWCODE
vwABSD_HISTCurrentABSD_HIST(no company join)
vwABSD_HIFLCurrentABSD_HIFL(country join)
vwABSD_HITLCurrentABSD_HITL(no company join)
vwABSD_HIBRCurrentABSD_HIBR(builder join)
Views VSL_ Output Layer Views
vwVSL_OWNER_INO — Owner Roles View
SELECT VSLD.*, OVG.*, VSLO1.* AS ManagingCompany, VSLO2.* AS OperatingCompany, VSLO3.* AS CharteringCompany, VSLO4.* AS RegisteredOwner FROM VSL_DESIGNATION VSLD JOIN ABSD_OVGE OVG ON VSLD.Imo_num = OVG.LRNO -- IMO_NUM = LRNO join LEFT JOIN vsl_owner_info VSLO1 ON VSLD.facility_id = VSLO1.facility_id AND VSLD.Class_num = VSLO1.Class_num AND VSLO1.role = 'Managing' LEFT JOIN vsl_owner_info VSLO2 ON VSLD.facility_id = VSLO2.facility_id AND VSLD.Class_num = VSLO2.Class_num AND VSLO2.role = 'Operating' LEFT JOIN vsl_owner_info VSLO3 ON VSLD.facility_id = VSLO3.facility_id AND VSLD.Class_num = VSLO3.Class_num AND VSLO3.role = 'Chartering' LEFT JOIN vsl_owner_info VSLO4 ON VSLD.facility_id = VSLO4.facility_id AND VSLD.Class_num = VSLO4.Class_num AND VSLO4.role = 'RegisteredOwner'
Critical cross-family 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.
vwVSL_TONNAGE — Tonnage with Regulation Preference
SELECT VSLD.*, itc.GROSS_TONNAGE AS ITC_GT, itc.NET_TONNAGE AS ITC_NT, nat.GROSS_TONNAGE AS NAT_GT, nat.NET_TONNAGE AS NAT_NT, COALESCE(itc.GROSS_TONNAGE, nat.GROSS_TONNAGE) AS PREFERRED_GT FROM VSL_DESIGNATION VSLD LEFT JOIN VSL_TONNAGE itc ON VSLD.Class_num = itc.Class_num AND itc.TONNAGE_REGULATION LIKE '%ITC%' LEFT JOIN VSL_TONNAGE nat ON VSLD.Class_num = nat.Class_num AND nat.TONNAGE_REGULATION NOT LIKE '%ITC%'

ITC-69 tonnage is preferred over national tonnage in the COALESCE logic.

Reference Implicit Relationship Model — No FK Constraints
No enforced foreign key constraints exist in this database. All relationships are implicit, enforced via triggers. The table below documents all key relationships established by view JOIN conditions and trigger logic.
Parent TableChild TableJoin ConditionRelationship
ABSD_OVGEABSD_OVNALRNO = LRNO1:many — vessel → name history
ABSD_OVGEABSD_HIOWLRNO = LRNO, SEQNO1:many — vessel → owner history
ABSD_OVGEABSD_HIMALRNO = LRNO, SEQNO1:many — vessel → manager history
ABSD_OVGEABSD_HISMLRNO = LRNO, SEQNO1:many — vessel → ship manager
ABSD_OVGEABSD_HIOPLRNO = LRNO, SEQNO1:many — vessel → operator
ABSD_OVGEABSD_HIPPLRNO = LRNO, SEQNO1:many — vessel → parent company
ABSD_OVGEABSD_HIFLLRNO = LRNO, SEQNO1:many — vessel → flag history
ABSD_OVGEABSD_HITLLRNO = LRNO, SEQNO1:many — vessel → tonnage history
ABSD_OVGEABSD_HISTLRNO = LRNO, SEQNO1:many — vessel → status history
ABSD_OVGEABSD_HIFC1LRNO = LRNO, SEQNO1:many — vessel → classification
ABSD_OVGEABSD_HIBBCLRNO = LRNO, SEQNO1:many — vessel → bareboat charterer
ABSD_OVGEABSD_HIGBOLRNO = LRNO, SEQNO1:many — vessel → group owner
ABSD_OVGEABSD_STSELRNO = LRNO, SEQNO1:many — vessel → build records
ABSD_OVGEABSD_CAGE1LRNO = LRNO1:many — vessel → incidents
ABSD_OVGEABSD_FUGELRNO = LRNO1:1 — vessel → capacity
ABSD_OVGEABSD_TANKERLRNO = LRNO1:1 — vessel → tanker details
ABSD_OVGEABSD_GROUP_FLEETLRNO = LRNO1:1 — vessel → fleet grouping
ABSD_OVGEVSL_DESIGNATIONLRNO = IMO_NUM1:1 — LRNO equals IMO number
ABSD_HIOWABSD_OWGEH01_OWNER_CODE = OWCODEmany:1 — owner records → company
ABSD_HIMAABSD_OWGEH02_MANAGER = OWCODEmany:1 — manager records → company
ABSD_HISMABSD_OWGESHIPMANAGER = OWCODEmany:1
ABSD_HIOPABSD_OWGEOPERATOR_CODE = OWCODEmany:1
ABSD_HIPPABSD_OWGEH03_PPC = OWCODEmany:1
ABSD_OWGEABSD_OWXROWCODE = OWCODE1:many — company → relationships
ABSD_OWGEABSD_OWSHOWCODE = OWCODE1:many — company → ship links
ABSD_OWGEABSD_OWNAOWCODE = OWCODE1:many — company → name history
ABSD_CAGE1ABSD_CADILRNO+INNO = LRNO+INNO1:1 — incident → disposal detail
ABSD_CAGE1ABSD_CALALRNO+INNO = LRNO+INNO1:1 — incident → location
ABSD_CBPPROOTABSD_CBPDcountry+town = country+town1:1 — port root → port details
ABSD_CBPPROOTABSD_CBTO1country+town = country+town1:1 — port root → town master
ABSD_CBCOROOTABSD_CBCONAMEOWCODE = OWCODE1:many — company → names
ABSD_CBCOROOTABSD_CBCOADDROWCODE = OWCODE1:many — company → addresses
ABSD_CBCOROOTABSD_CBCOCOMMOWCODE = OWCODE1:many — company → communications