---
title: "SQL-015: AuditQueryProvider.GetNationalDrugCode"
summary: Read operation for `AuditQueryProvider.GetNationalDrugCode`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-015: AuditQueryProvider.GetNationalDrugCode

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `AuditQueryProvider.GetNationalDrugCode`.

## Classification

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


## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_NATIONAL_DRUG](../database-tables.md#cbp_national_drug) | SELECT | NATIONAL_DRUG_CODE, UPDATE_NUM, GENERIC_NAME, EFF_DATE, EXP_DATE, PRODUCT_NAME, UPDATE_USER, UPDATE_DATE |

## LINQ statement

Source: `Data/SAIF.Data/Queries/AuditQueryProvider.cs:44`.

```csharp
var repo = Factory.GetRepository<CbpNationalDrug>().Query();
var obj = repo.SingleOrDefault(x => x.Code == code);
```

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

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  CND.NATIONAL_DRUG_CODE,
  CND.UPDATE_NUM,
  CND.GENERIC_NAME,
  CND.EFF_DATE,
  CND.EXP_DATE,
  CND.PRODUCT_NAME,
  CND.UPDATE_USER,
  CND.UPDATE_DATE
FROM CBP_NATIONAL_DRUG CND
WHERE CND.NATIONAL_DRUG_CODE = :code
-- NHibernate expects at most one row
```

## Operations and processes

- [Bill audit evaluation](../operations/bill-audit-evaluation.md)

## Business rules

- [SD-BR-030 Nurse review required if any audited service code flags it](../business-rules.md#sd-br-030-nurse-review-required-if-any-audited-service-code-flags-it)
- [SD-BR-031 Duplicate services excluded from count](../business-rules.md#sd-br-031-duplicate-services-excluded-from-count)
- [SD-BR-032 Unset thru-date treated as open-ended](../business-rules.md#sd-br-032-unset-thru-date-treated-as-open-ended)

## Sources
- `Data/SAIF.Data/Queries/AuditQueryProvider.cs:44`
