---
title: "SQL-022: Retrieve IMAGE_DOCUMENT_NAME_CODE by key (possibly incomplete)"
summary: Retrieves an IMAGE_DOCUMENT_NAME_CODE row with a culture-specific description; RetrieveSQL ends with a bare WHERE clause and may be an incomplete implementation.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.Imaging
reference_type: package
---

# SQL-022: Retrieve IMAGE_DOCUMENT_NAME_CODE by key (possibly incomplete)

This statement selects from `IMAGE_DOCUMENT_NAME_CODE` with a LEFT JOIN to `IMAGE_DOCUMENT_NAME_GCODE` for culture-specific descriptions. The `RetrieveSQL` ends with a bare `Where` keyword and `BeforeRetrieve` adds no predicate text, making this path possibly dead or incomplete code**.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-022 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text** |
| **Business object** | `clsImageDocumentNameCode` |
| **Criteria property** | `RetrieveSQL` |
| **Lifecycle method** | `BeforeRetrieve` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:cultureCode` | Input | [not specified]** | N/A | Culture code for localized description lookup (referenced inside `upper(:cultureCode)`)** |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [IMAGE_DOCUMENT_NAME_CODE](../database-tables.md#image_document_name_code) | SELECT | CODE, CODE_DESCR, INTERNAL_DESCR, IMAGE_FILE_CODE, IMAGE_CATEGORY_CODE, IMAGE_DOCUMENT_TYPE_CODE |
| [IMAGE_DOCUMENT_NAME_GCODE](../database-tables.md#image_document_name_gcode) | SELECT / LEFT JOIN | CODE, CODE_DESCR, CULTURE_CODE |

## Sample SQL

```sql
-- Note: SQL ends with bare WHERE — likely an incomplete implementation**
Select
    c.CODE as Code,
    case when gc.code_descr is not null
         then gc.code_descr
         else cast(c.CODE_DESCR as nvarchar2(100))
    end as CodeDescr,
    c.INTERNAL_DESCR as InternalDescr,
    c.IMAGE_FILE_CODE as ImageFileCode,
    c.IMAGE_CATEGORY_CODE as ImageCategoryCode,
    c.IMAGE_DOCUMENT_TYPE_CODE as ImageDocumentTypeCode
From IMAGE_DOCUMENT_NAME_CODE c
left join image_document_name_gcode gc
    on C.CODE = gc.code
    and gc.culture_code = upper(:cultureCode)
Where
```

## Operations and processes
- [Code table management](../operations/code-table-management.md)

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.Imaging\clsImageDocumentNameCode.vb`
