Section 12e
Stored Procedures — External Data & System  ·  2026-05-03

12e Stored Procedures — External Data & System

PSC port-state-control loaders (11 MOU sources), OFAC/UN sanctions integrations, data loading pipelines (Janes, SBR, AIS, MSC), production output SPs (APS, NB Email, EDM), codebook row-source SPs (80+), and DBA tooling (Spot_* diagnostics, Fog_* performance monitors).

PSC Pipeline Overview

Port State Control (PSC) inspection data from 11 MOU regional bodies is loaded into ABSD_INSPECTION_VISITS, ABSD_DEFECT, and ABSD_DETENTION. Each source has a three-SP set: Insert, Update, Delete — totalling ~60 PSC SPs.

Upsert model: All PSC data uses a surrogate key (source + source_inspection_id). The Insert SP handles new records; Update handles field changes on existing records; Delete (or via spPSC_Delete_*) removes records no longer present in the latest extract. Each source's extract file is compared against the existing ABSD data using the source reference key.

PSC Insert / Update / Delete Pattern

-- Insert pattern
CREATE PROCEDURE spPSC_Insert_ParisMOU
AS
    INSERT INTO ABSD_INSPECTION_VISITS (LRNO, SOURCE, INSPECTION_DATE, PORT_CODE, RESULT, ...)
    SELECT d.LRNO, 'PARIS', d.InspDate, d.Port, d.Result, ...
    FROM tblDetentionsTempParis d  -- staging table pre-loaded from extract
    LEFT JOIN ABSD_INSPECTION_VISITS v
        ON v.SOURCE = 'PARIS' AND v.SOURCE_REF = d.SourceRef
    WHERE v.SOURCE_REF IS NULL  -- no existing record → new

The staging table (e.g. tblDetentionsTempParis) is populated by a preceding spCreateDetentionsTemp* SP which parses the raw file, resolves LRNOs via ABSD_SHIP_SEARCH, and applies basic format normalisation. The spPSC_Delete_* SPs then remove any ABSD records for the source that were NOT in the latest extract (indicates the MOU has corrected/removed them).

PSC Sources (11 MOU Bodies)

SourceSP PrefixNotes
Paris MOUspPSC_*_ParisMOULargest source. Both XML and legacy flat-file variants: spPSC_Insert_ParisMOU_XML, spPSC_Insert_ParisMOU_XML_Certs, spPSC_Insert_ParisMOU_XML_Extras. Daily delta loader: spPSC_Insert_ParisMOU_Daily. Also spParisMOU_DetentionsDataPUCKER for PUCKER deduplication. spInsertIntoTblPSC_Daily_ParisDetentions_Download for the daily parking table.
Tokyo MOUspPSC_*_TokyoMOUDaily variant: spPSC_Insert_TokyoMOU_Daily / spPSC_Daily_Tokyo_LoadDefects
USCGspPSC_*_USCGUSCG extra fields: spPSC_Delete_USCG_Extra
AMSA (Australia)spPSC_*_AMSACertificate: spCreateCertificateTempAMSA, Deficiency: spPopulate_AMSA_DEFICIENCY, Inspection: spPopulate_AMSA_INSPECTION_VISIT
Black Sea MOUspPSC_*_BlackSeaDaily delta: spPSC_Insert_BlackSea_Daily / spPSC_Daily_BlackSea_LoadDefects
Caribbean MOUspPSC_*_CaribbeanMOUNew format variant: spPSC_*_CaribbeanMOU_new
Indian Ocean MOUspPSC_*_IndianOceanExtras: spCreatePopulate_ABSD_INSPECTION_EXTRAS_IndianOcean, spCreatePopulate_ABSD_PSC_CERTIFICATE_IndianOcean
Mediterranean MOUspPSC_*_MedMOU
Riyadh MOUspPSC_*_RiyadhMOU
VDM (Vetting)spPSC_*_VDMDeletes: spDeleteVDMDefects / spDeleteVDMInspections
Paris Daily (batch)spPSC_Daily_Paris_LoadDefectsLoads defect detail from daily Paris download

PSC Daily Load SPs

Three daily-delta loader SPs for sources that publish incremental updates:

spPSC_Daily_Paris_LoadDefects — loads defects from daily Paris XML download into ABSD_DEFECT
spPSC_Daily_Tokyo_LoadDefects — loads defects from daily Tokyo flat-file
spPSC_Daily_BlackSea_LoadDefects — loads defects from daily Black Sea extract

All three: resolve LRNO via ABSD_SHIP_SEARCH, insert new defect records, skip duplicates (SOURCE + SOURCE_REF uniqueness check), write count of inserted rows to job log.

OFAC Sanctions Integration

OFAC (US Office of Foreign Assets Control) sanctions data is loaded and matched against ABSD company and vessel records.

SPPurpose
spOFAC_LoadDataLoads raw OFAC SDN (Specially Designated Nationals) list into tblOFAC_SDN staging
spOFAC_LoadNonDataLoads OFAC non-SDN consolidated list (broader sanctions)
spOFAC_LoadOwcodeDataMaps matched OFAC entities to ABSD OWCODE records
spOFAC_CleanTempTableTruncates OFAC staging tables before new load
spOFAC_OWSanctions_NEWLOAD_deltasRptDelta report: new sanctions vs prior load
spOFAC_OWSanctions_NEWLOAD_ADDRESS_DeltasRptAddress-level delta for sanctions
spOFAC_OWSanctions_NEWLOAD_ALTID_DeltasRptAlt-ID delta (IMO numbers etc) for sanctions
spPopulateBESSanctions_PROCESSEDWrites processed sanctions status to BES (beneficial entity screening) table
spUpdateRiskScreeningDataUpdates risk scores in tblRiskScreening from OFAC + UN data
spUpdateRiskScoresAggregates multiple risk sources into overall vessel risk score

The sanctions status for company records is stored in SUPPLEMENTAL_ABSD_CBCY (see Section 09) via the country-of-registration flag. Vessel-level sanctions screening updates tblRiskScreening which feeds the Seaweb risk product.

UN Sanctions

spUNSanctions_LoadData

Loads UN Security Council consolidated sanctions list into tblUNSanctions staging. Matches against ABSD company records by name (using CleanCompanyNameForMatch + phonetic matching) and IMO number. Matched records are flagged in tblRiskScreening. Run after each UN update (typically weekly).

Janes Data Load Pipeline

Janes Defence supplies naval vessel data (warships, auxiliaries) not covered by LR survey. Seven SPs load different Janes data types:

SPData Type
spJanesInsertShipDataBasic vessel data (LRNO, name, type, dimensions)
spJanesInsertStatusDataStatus codes (active/laid-up/reserve/decommissioned)
spJanesInsertCountryDataFlag/country codes
spJanesInsertShipClassDataClass/type grouping data
spJanesInsertShipClassTaxonomyDataClass hierarchy (taxonomy tree)
spJanesInsertMediaBlockDataMedia/image block references
spJanesDataReseedTruncates all Janes staging tables before fresh load

spLOAD_ABSD_* — Bulk Data Load SPs

SPLoads
spLOAD_ABSD_AUX_ENGINESBulk loads auxiliary engine records from external source into ABSD_MAAU
spLOAD_ABSD_PORTCONVPort code conversion table refresh from standard port code source
spLOAD_ABSD_SDDBSDDB (Ship Dimensional Database) bulk load into dimension tables
spLOAD_MSC_TEMP_CARGO_CODEMSC cargo code mapping to ABSD cargo type codes
spLOAD_MSC_TEMP_ENGINE_DETAILSMSC engine specification load
spLOAD_MSC_TEMP_LGMSC load gauge/specification data
spLOAD_MSC_TEMP_SHIPTYPEMSC ship type mapping

SBR Processing

SBR (Survey/Build Record) data comes from external survey bodies.

SPPurpose
spSBRProcessCurrentAgainstLRFCompares current SBR data against LRF (LR Fairplay) baseline; identifies discrepancies
spSBRTIPProcessCurrentAgainstLRFSBR data processed through the TIP validation pipeline
spSBREmailHandlerErrorEmails error alerts when SBR load fails or produces high discrepancy count
spSBRProcessedAttachmentsLists SBR email attachments that have been processed
spImportSBRIntoTIPImports validated SBR records into the TIP Classic pipeline for processing

TIP/MIS SP Reference

The TIP/MIS pipeline (~100 SPs) is documented in full in Section 08. Quick reference of the key SPs by phase:

PhaseKey SPs
Load & stagespTIPPSCLoad, spTIPMRRegularImport, spTIPAISregularImport_OLD
LRNO derivationspTIPDeriveLRNO
ValidationspTIPValidate, spTIPValidateCallsign, spTIPValidateDateTime, spTIPValidateDecimal, spTIPValidateInteger, spTIPValidateVarchar, spTIPAutoValidate*
LRF comparisonspTIPProcessCurrentAgainstLRF, spTIPProcessCurrentDateTimeAgainstLRF, spTIPProcessCurrentDecimalAgainstLRF, spTIPProcessCurrentIntegerAgainstLRF, spTIPProcessCurrentVarcharAgainstLRF
Action processingspTIPProcessUpdate, spTIPMarkAsProcessed, spTIPAutoProcess*
FlexTemp pipelinespTIPMISValidate, spTIPMISProcessCurrentAgainstLRF, spTIPMISManipulationRulesEngine, spTIPMISBusinessRule_Flextemp_Update
Expiry / cleanupspTIPExpireData, spTIPCleanUpOldSupplies, spTIPMISExpireData

spProduction* — APS Output Generation

The Production SPs generate the data feeds consumed by the APS (Annual Publication System) for Register Book and online output. Each SP runs a large SELECT across multiple ABSD_ tables, applies the APS field formatting rules, and writes to a production output staging table.

SPOutput
spProductionNarrativesGenerates APS narrative text for vessels by calling fnAPSNarrative* family functions. Primary Register entry text.
spProductionExtrasGenerates supplementary data fields for Register (capacity tables, special features, certificates). Note: an _Old20April2026 version is kept as rollback.
spProductionCasualtiesGenerates casualty section data from ABSD_CAGE1/CADI/CACO/CALA
spProductionCasualtiesEventsGenerates casualty event detail data
spProductionEngineBuilderGenerates engine builder data (ABSD_MAEM1 + ABSD_HIMO + builder OWNA join)

Companion: spAPSRELBUILDERHISTORY — APS relationship builder history (generates the "formerly owned by" ownership history section). spPopulateAPSRelSurveyDates — populates APS survey date fields from ABSD_LRSC/LRSU.

NB Email Builder SPs

Generates email notifications for newbuild status changes sent to subscribers:

SPPurpose
spNBEmailEngineDetailGenerates engine specification text block for NB email body
spNBEMailBuilderAddressFormats builder address for NB email
spNBEMailBuilderCommsFormats builder communications details for NB email
spNBEMailOwnerAddressFormats owner address for NB email
spNBEMailOwnerCommsFormats owner communications details for NB email
spNBEMailownerCommsVariant — note lowercase 'o' (legacy naming)

FSW (Fairplay Seaweb) NB page SPs: spFSWSalePageExName, spFSWSalePageLastSale, spFSWSalePageSameOperator — build the FP newbuild page sections for the online Register.

spEDM_BF_* — EDM Backfill

EDM (Entity Data Master) backfill SPs populate ABSD records from the EDM platform during the partial migration:

SPBackfills
spEDM_BF_ANNOTATIONSCopies tblChanges annotations from EDM entity annotations to ABSD annotation tables
spEDM_BF_CBPIBackfills ABSD_CBPI (P&I club codebook) from EDM club records
spEDM_BF_HTML_BODYBackfills HTML body text fields from EDM content management
spEDM_BF_PANDIBackfills ABSD_PANDI P&I insurance records from EDM insurance data
spEDM_BF_PSCBackfills PSC inspection records from EDM PSC store

sp*RowSource* — UI Codebook Lookup SPs (80+)

RowSource SPs power the dropdown lists and lookup fields in the Captiva data-entry UI. Each SP returns a two-column result set: (Code, Description) ordered for display. They query the ABSD_CBUB1 codebook table filtered by FLDI (field discriminator) code, or in some cases query dedicated reference tables directly.

Naming convention: SP names map to the field they serve: spD07_CODEValidRowSource → ABSD_FUCA2.D07_CODE field. spFlagDecodeRowSource → flag state dropdown. spB09_FOR_CLASSRowSource → foreign class society code lookup.
CategorySPs
Cargo type / stowagespD01_INT_BASICRowSource, spD01_TYPAllRowSource, spD03_ALT_CODE_3RowSource, spD07_CODEValidRowSource, spD07_CODEValidRowSourceWithMainGroup, spD07_CODEValidRowSourceWithSubGroups, spD08_COMMODITYRowSource, spD08_StowageRowSource
Structural materialspD09_MATRowSource, spD09_POSRowSource, spD09_TYPRowSource, spD10_OTHER_TYPRowSource, spD16_MATRowSource, spD16_PSTNRowSource, spD16_TYPRowSource
Deck / fitting typespD11_SMESRowSource, spD11_TYPERowSource, spD12_ALINRowSource, spD12_DSGNRowSource, spD12_LNNGRowSource, spD12_SHPRowSource, spD12_TYPRowSource
Loading gear / rampspD17_POSRowSource, spD19_LG_TYPRowSource, spD20_ATYPERowSource, spD23_RAMP_TYPERowSource, spE36_GEAR_TYPRowSource
Electrical / enginespE45_GSRowSource, spE54_GTRowSource, spE63_PROP_TYPRowSource, spE87_FTYPRowSource, spE95_THST_STATRowSource, spE95_THST_TYPRowSource
Flag / country / portspFlagDecodeRowSource, spFlagDecodeNoCodeRowSource, spCountryDecodeCurrentRowSource, spPortDecodeRowSource, spPortRowSource, spPortRowSourceCasualtySearch
Fuel / tankspF08_CABGRADRowSource, spF09_TXTRowSource, spF11_CODERowSource, spF18_TYPERowSource, spTankRowSource, spTankCoatRowSource
Hull / structurespG01_HULL_SECNRowSource, spC01_HUL_CONNRowSource, spC01_HUL_MATRowSource, spC01_HUL_SECNRowSource, spHullShapeRowSource, spHullTypeRowSource, spHEATMATERIALRowMaterial
Status / type codesspStat5CodeRowSource, spStat5CodewithHullShape, spStat5CodewithoutHullShape, spStandardDesignRowSource, spSubTypeRowSource (and variants A–E, WithStatCode), spTONTYPRowSource
Class / surveyspB09_FC_STRowSource, spB09_FOR_CLASSRowSource, spCLASSDecodeRowSource, spLRCLASSINDRowSource, spINSTRowSource
Address / companyspABSD_OWAD1CountryRowSource, spABSD_OWAD1TownRowSource, spCountryDecodeCurrentRowSource, spStreetRowSource, spTownRowSource, spTownRowSourceButNotPostalStyle, spTownRowSourceButNotPostalStyleForBuilders, spSalutationRowSource
Casualty / breakerspCasualtyBreakerRowSource, spD05_PRTYPRowSource, spD05_SCRPARowSource, spOE01_CARowSource
OtherspA02_STSRowSource, spCurrencyDecodeRowSource, spDCDecodeRowSource, spEMDecodeRowSource, spESDecodeRowSource, spMetaMainCategoryRowSource, spMetaSubCategoryRowSource, spPandICodeRowSource, spPOS_CODERowSource, spPositionRowSource, spPOSRowSource, spSBPOS_RowSource

Codebook Helper SPs

SPPurpose
spGetCompanyNameReturns company display name for a given OWCODE (from ABSD_OWNA)
spGetCompanyNameAnnoReturns company name formatted for annotation display
spGetCountryNameReturns country name for a 3-char ISO code (from ABSD_CBCY)
spGetDate / spGetDatesReturns formatted current date / date range for use in batch SP headers
spGetForeignClassReturns foreign classification society name for ABSD_FOR_CLASS records
spGetLRClassReturns LR class notation text for ABSD_HILC records
spGetEngineDetailsReturns formatted engine summary text for a vessel (for UI display)
spGetCapacitiesReturns formatted capacity summary (TEU, DWT, cargo type) for a vessel
spGetTownName / spCreateTownNameLookup and creation for port/town names in ABSD_CBUB1

Spot_* — SQL Server Diagnostics (60 SPs)

The Spot_* family (approximately 60 SPs) are SQL Server administration and diagnostic tools, not maritime business logic. They are installed in LRUpdate but are generic DBA tooling. Key categories:

CategorySPs
Connection monitoringSpot_Connections, Spot_ConnectionDetails, Spot_ConnectionList, Spot_IWOldestTransactions
Locking / blockingSpot_Locks, Spot_LockStats, Spot_LatchesLocks, Spot_WaitsList
Database infoSpot_DatabaseInfo, Spot_FilesGroupsDisksList, Spot_GetAllDBList, Spot_GetDBProperties, Spot_GetDBStatus
Object inspectionSpot_IWObjectColumns, Spot_IWObjectDepends, Spot_IWObjectIndexes, Spot_IWObjectPermissions, Spot_ObjectsByDatabase
Buffer / memorySpot_BufferCacheContents, Spot_BufferManager, Spot_GetMemoryDetails, Spot_GetMinPotentialAvailable, Spot_ProcCacheByType
Job monitoringSpot_Jobs, Spot_JobDurations (via spJobDurations), Spot_LogMessage
Error logSpot_CheckErrorlogSize, Spot_GetErrorlogFileInfo, Spot_ListErrorlogs
ReplicationSpot_CheckIfReplicationInstalled, Spot_LogShippingInSync, Spot_LogShippingMonitorInfo, Spot_ReplicationReinit
Refresh / maintenanceSpot_RefreshDB_DBStatus, Spot_RefreshDB_FileChange, Spot_RefreshDB_IXChange, Spot_RefreshDB_MaintainFGInfo, Spot_Cleanup1
MiscSpot_Statistics, Spot_TableSize, Spot_TablesList, Spot_VersionInfo, Spot_GlobalVariables, Spot_ServerInfo (via Spot_GetServerInfo), Spot_SQL2K_IOByFile

Fog_* — Performance Monitoring SPs

SPMonitors
Fog_AMPerfInfoAlwaysOn / availability group performance metrics
Fog_BMPerfInfoBuffer manager performance counters
Fog_DBPerfInfoDatabase-level performance counters (I/O, transactions/sec)
Fog_JobsSQL Agent job status and recent run history
Fog_MMPerfInfoMemory manager performance counters

DBA / Utility Miscellaneous

SPPurpose
dba_Perf_FilestatGatheringCollects I/O filestat snapshot for trending analysis
sp_leadblockerIdentifies the head-of-chain blocking process (kills it after confirmation)
sp_lock2Enhanced sp_lock showing lock details with object names
sp_TableStatsCountsReturns row counts for all tables in the database
TableCountsQuick row-count summary for monitoring table growth
TableListReturns all tables with their creation date and schema
SearchAllTablesSearches all varchar columns in all tables for a given string (slow — admin use only)
spReIndexAllTablesRebuilds all indexes in the database (scheduled weekly maintenance)
spGrantPublicAllPermissionsGrants EXECUTE on all SPs and SELECT on all tables to the public role
spJobFailureCheckerChecks for failed SQL Agent jobs in the last 24h and sends alert email
spJobDurationsReturns recent job run times for SLA monitoring
qs_spc_min_versionReturns minimum compatible version string for the QS SPC monitoring tool
spsysGetTableDetails / spsysGetTableFieldCountSchema introspection: returns table column details and field counts
spFindTabs / spFindTextSearches SP/function bodies for tab characters or specific text strings
spReportSpecialCharactersReports records containing non-ASCII or problematic special characters
Clean_CharactersCleans special characters from a specified table/column (admin utility)
SeperateWordsString utility: splits a delimited string into a result set of words
SGTESTSeaweb/Global test SP — functional test entry point
_DELETEITALL_Nuclear option: drops all tables/SPs/views (NEVER run in production — test environment only)
spMailboxReaderSettingsConfigures settings for the automated mailbox reader that processes incoming SBR/TIP emails
spRetrieveEmailAddressfromADLooks up email address from Active Directory for a given Windows username
spPinkMailSentLogs that a "pink mail" (internal data alert) has been sent for a vessel
Section 12e  ·  LR Maritime Database Documentation  ·  2026-05-03