Skip to content

SQL-132: Retrieve CbpProcedureCode via QueryProcedure

This ORM statement performs a read operation on CbpProcedureCode via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Claims/Bills/ProcedureService.cs (L30).

Classification

Field Value
SQL ID SQL-132
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object CbpProcedureCode
Criteria property N/A — ORM
Lifecycle method QueryProcedure

Parameters

Parameter Direction Type Max length Description
code Input ** N/A x.Code == code → column CODE
null Input ** N/A x.ExpirationDate == null → column EXP_DATE
DateTime.Today Input ** N/A x.ExpirationDate > … → column EXP_DATE

Tables

Table Access Columns used
CBP_PROCEDURE_CODE SELECT CODE, UPDATE_NUM, CODE_DESCR, SHORT_DESCR, EFF_DATE, EXP_DATE, UPDATE_USER, UPDATE_DATE, ICD_VERSION_CODE

LINQ statement

Source: Services/SAIF.Services/Claims/Bills/ProcedureService.cs:30

// Services/SAIF.Services/Claims/Bills/ProcedureService.cs:30-31
            var Procedure = unitOfWork.GetRepository<CbpProcedureCode>().Query().FirstOrDefault(x => x.Code == code
                && (includeExpired == true || (x.ExpirationDate == null || x.ExpirationDate > DateTime.Today)));

Sample SQL

Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
-- Services/SAIF.Services/Claims/Bills/ProcedureService.cs:30
SELECT *
FROM (
  SELECT
    CPC.CODE,
    CPC.UPDATE_NUM,
    CPC.CODE_DESCR,
    CPC.SHORT_DESCR,
    CPC.EFF_DATE,
    CPC.EXP_DATE,
    CPC.UPDATE_USER,
    CPC.UPDATE_DATE,
    CPC.ICD_VERSION_CODE
  FROM CBP_PROCEDURE_CODE CPC
  WHERE CPC.CODE = :code
    AND (:includeExpired = 1 OR (CPC.EXP_DATE IS NULL OR CPC.EXP_DATE > :today))
)
WHERE ROWNUM <= 1

Translation notes: - includeExpired == true references only a method argument -> pre-evaluated client-side; rendered as :includeExpired = 1. - DateTime.Today -> :today.

Operations and processes

Sources

  • Services/SAIF.Services/Claims/Bills/ProcedureService.cs (L30)