Skip to content

Add skill for SQL usage domains (#69) - #101

Open
knutman wants to merge 1 commit into
oracle:mainfrom
knutman:69-usage-domains
Open

Add skill for SQL usage domains (#69)#101
knutman wants to merge 1 commit into
oracle:mainfrom
knutman:69-usage-domains

Conversation

@knutman

@knutman knutman commented Jul 30, 2026

Copy link
Copy Markdown

Closes #69.

What this adds

db/features/usage-domains.md — a practical skill for Oracle SQL usage domains (23ai+), covering:

  • All four domain flavors with runnable examples: single-column, enum (both the check-constraint pattern and native ENUM domains), multi-column (currency composite with DOMAIN_DISPLAY/DOMAIN_ORDER over a column list), flexible domains (discriminant column), plus JSON-schema domains and the built-in SYS domains.
  • Association semantics: the three attach syntaxes, validation on re-attach, one-domain-per-column (ORA-11512), STRICT vs non-strict (non-strict ignores precision/scale entirely).
  • The full lifecycle: ALTER DOMAIN (display/order/annotations only), DROP DOMAIN [FORCE [PRESERVE]] incl. recycle-bin dependents, and a safe recreation sequence for the unalterable parts (data type, check constraints) with the FORCE vs FORCE PRESERVE trade-off.
  • A dictionary/function reference table (DOMAIN_CHECK, DOMAIN_CHECK_TYPE, CAST ... AS DOMAIN, the USER_DOMAIN_* views) and ten best practices, including the PL/SQL limitation (no domain-typed variables or parameters — type safety ends at the table).
  • ## Oracle Version Notes (19c baseline: feature absent; 23ai vs newer release updates) and a ## Sources section.

Also updates the db/features/ row in db/SKILL.md (category routing).

How it was validated

  • Syntax and semantics checked against the CREATE/ALTER/DROP DOMAIN pages of the Oracle Database 26 SQL Language Reference and the domain functions reference (linked in ## Sources).
  • Cross-checked against Oracle-Base's 23ai domains article and Chris Saxon's UKOUG 2023 slides.
  • Statements exercised hands-on against Oracle Database 23ai (version 23.26); observations that go beyond the documentation (silent no-op when detaching a single column, recycle-bin rows blocking DROP DOMAIN, the NAME column in USER_DOMAIN_CONSTRAINTS) are explicitly marked as verified on that version.

Review steps

  1. Open db/features/usage-domains.md, pick any example and run it against a 23ai instance (23.7+ for ALTER DOMAIN/native ENUM).
  2. Check the routing line in db/SKILL.md renders correctly.

Covers single-column, enum (check-list and native ENUM), multi-column,
flexible and JSON-schema domains, STRICT association, ALTER DOMAIN
(display/order/annotations), DROP DOMAIN FORCE [PRESERVE], a safe
recreation sequence for constraint/type changes, domain functions,
dictionary views, version notes and sources. Adds the features routing
entry in db/SKILL.md.

Signed-off-by: Knut Göttling <kg@enignum.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add skill for data use case domains

1 participant