Skip to content

Installing the VARCHAR2/NVARCHAR2 Types

This is a separate, optional install — not part of either core install mode above, and not created by CREATE EXTENSION orafce_no_c or the standalone script. See Working with Types onward for what it actually is and why it exists; this chapter only covers installing it.

When you need it

Only if your migrated code actually declares variables or table columns typed VARCHAR2(n)/NVARCHAR2(n). Use oracle.orafce_audit() and the catalog query in VARCHAR2 and NVARCHAR2 to find out before installing anything.

Prerequisite

Requires the oracle schema to already exist — either core install mode above includes it, so install one of those first. This add-on reuses that existing schema; it does not create its own.

Installing

psql -d <database> -f sql/11_oracle_varchar2_domains.sql

This creates roughly 2,010 domains (oracle.varchar_<N>b, oracle.varchar_<N>c, oracle.nvarchar_<N>c, for lengths 1–4000) — no casts, no shared functions, nothing else. Every domain is an independent CREATE DOMAIN ... CHECK (...) statement, so this step can be run more than once safely as long as none of the domains already exist (a rerun after dropping the schema, for instance).

Uninstalling

There's no separate uninstall script for this add-on specifically — dropping the oracle schema (as part of uninstalling the core package, see Uninstalling) removes these domains along with everything else in that schema. If you only want to remove the domain family while keeping the rest of oracle intact, drop them individually or regenerate a version with fewer lengths (see Customizing the Type Family) and diff against what's currently installed.

After installing

Rewrite your migrated code to point at the new domains instead of VARCHAR2/NVARCHAR2 — see VARCHAR2 and NVARCHAR2 for the rewrite tool.

Continue to Why It Refuses to Install Over Real orafce.