ReadonlynameThe name of the dialect
ReadonlylibraryThe database library or driver being used
Connect to the Oracle database
Disconnect from the Oracle database
Get the current connection from pool
Check if connected
Stream query results using a correct ROWNUM-windowed pagination query
(see createOracleQueryStream() in src/dialects/query-stream-helper.ts)
rather than this dialect's own buildLimitOffset(), whose bare
WHERE ROWNUM <= n doesn't actually skip the first offset rows.
The SELECT statement to stream
Optionaloptions: StreamOptions
Streaming options (batch size, backpressure watermark, model mapping)
Escape a value for use in a query
Escape an identifier (Oracle uses double quotes, same as quoteIdentifier). Without the surrounding quotes, Oracle folds unquoted identifiers to uppercase, which breaks lookups for mixed-case table/column names created elsewhere via quoteIdentifier()/quoteTable().
Quote an identifier with double quotes (Oracle standard)
Quote a table name with optional schema
Optionalschema: stringGet database version
Create a schema.
Oracle has a CREATE SCHEMA statement, but it only exists to bundle a
batch of CREATE TABLE/CREATE VIEW/GRANT statements into one
transaction (CREATE SCHEMA AUTHORIZATION x <stmt> <stmt> ...) - it does
not, by itself, create a schema as a standalone object, and
CREATE SCHEMA AUTHORIZATION x with no accompanying statements is not
valid Oracle usage. In Oracle a schema is a user (every user owns
exactly one schema, and objects are always created "in" a user's
schema), so creating a schema really means creating a user. A random
password is generated since CREATE USER requires one; callers that
need a specific password (or other user attributes) should use the
User Management API (buildCreateUserQuery/UserManager.createUser)
directly instead.
Drop a schema.
Since a schema in Oracle is a user, dropping a schema means dropping
that user (DROP SCHEMA/DROP SCHEMA ... CASCADE are not Oracle
statements at all). CASCADE is always applied so that the user's
owned objects are dropped along with the user, matching the intent of
"drop this schema and everything in it". When ifExists is requested,
the statement is wrapped so that ORA-01918 ("user does not exist") is
silently ignored (see wrapIgnoringOraErrors); Oracle's own
DROP USER ... IF EXISTS syntax is 23c-only and would fail against the
19c/21c versions this dialect targets.
Optionaloptions: DropSchemaOptionsShow all schemas
List all schemas (Oracle users)
Create database SQL (Oracle uses tablespaces)
Drop database SQL
Create a table
Optionaloptions: TableOptionsCreate partitioned table (Oracle supports RANGE, LIST, HASH, and INTERVAL partitioning)
Optionaloptions: TableOptions & {Create partition Supports subpartitions in Oracle
"Attach" a partition (Oracle has no PostgreSQL-style ATTACH PARTITION
statement). The real Oracle equivalent for bringing an existing
standalone table's data into a partitioned table's partition is
ALTER TABLE ... EXCHANGE PARTITION ... WITH TABLE ..., which swaps the
data segment of the partition with that of the standalone table as a
fast, DDL-only (no data movement) operation.
options.exchangeTable names the standalone table whose data becomes
the partition's data; it defaults to options.partitionName for
backwards compatibility with callers that used the partition name and
the exchange-table name interchangeably.
"Detach" a partition (Oracle has no PostgreSQL-style DETACH PARTITION
statement). The real Oracle equivalent for extracting a partition's data
out into a standalone table is the same EXCHANGE PARTITION statement
used by attachPartition - it symmetrically swaps segments, so
"detaching" is exchanging the partition with an (often empty) standalone
table, leaving that table holding the former partition's data.
Drop partition Enhanced with cascade option for Oracle
Optionaloptions: { ifExists?: boolean; cascade?: boolean; updateIndexes?: boolean }Add a partition to an existing partitioned table (Oracle)
Name of the partitioned table
Name for the new partition
Partition specification
List partitions for a table with details
Modify partition (move, compress)
Optionaloptions: {Create foreign data wrapper (stub) Oracle uses Data Guard instead of FDW
Optional_options: { handler?: string }Drop foreign data wrapper (stub) Oracle uses Data Guard instead of FDW
Optional_options: { ifExists?: boolean }Create foreign server (stub) Oracle uses Data Guard instead of FDW
Optional_options: { options?: Record<string, string>; ifNotExists?: boolean }Drop foreign server (stub) Oracle uses Data Guard instead of FDW
Optional_options: { ifExists?: boolean }Create foreign table (stub) Oracle uses Data Guard instead of FDW
Optional_options: {Create user mapping (stub) Oracle uses Data Guard instead of FDW
Optional_options: { options?: Record<string, string>; ifNotExists?: boolean }Change owner of a table or view
Add a constraint to a table
Remove a constraint from a table
Drop a security policy (MSSQL Row-Level Security)
Create a view
Optionaloptions: ViewOptionsShow all views
Create a materialized view Oracle syntax: CREATE MATERIALIZED VIEW mv_name BUILD [IMMEDIATE | DEFERRED] REFRESH [FAST | COMPLETE | FORCE] ON [COMMIT | DEMAND] AS query
Refresh a materialized view Oracle supports: FAST, COMPLETE, FORCE
Optionaloptions: RefreshOptionsDrop a materialized view
Optionaloptions: DropMaterializedViewOptionsShow all materialized views
Check if a materialized view exists
Name of the materialized view
Optionalschema: string
Optional schema name
True if the materialized view exists
Create a materialized view log on a master table.
FAST (incremental) refresh - as used by refreshMaterializedView() -
requires a materialized view log on every master table referenced by the
materialized view; without one, DBMS_MVIEW.REFRESH(..., 'F') fails with
ORA-23413. This creates that log.
Oracle syntax:
CREATE MATERIALIZED VIEW LOG ON table_name
WITH [ROWID] [, PRIMARY KEY] [, SEQUENCE] [(col1, col2, ...)] [INCLUDING NEW VALUES]
Optionaloptions: MaterializedViewLogOptionsDrop a materialized view log from a master table.
Oracle syntax: DROP MATERIALIZED VIEW LOG ON table_name
(Oracle has no IF EXISTS variant for this statement.)
Optionaloptions: Pick<MaterializedViewLogOptions, "schema">Add a column
Remove a column
Change a column
Rename a table
Show all tables
Get table status (Oracle implementation)
OptionaltableName: stringGet table create statement (Oracle implementation)
Check if a table has partitions (Oracle implementation)
Show constraints for a table
Show indexes for a table
Add an index
Optionaloptions: IndexOptionsRemove an index
Create an index with full options
Create a constraint
Drop a constraint
Optionaloptions: DropConstraintOptionsGenerate SQL for creating a savepoint
Optionalname: stringGenerate SQL for releasing a savepoint
Generate SQL for rolling back to a savepoint
Build WHERE clause
Optionaloptions: BuildOptionsBuild ORDER BY clause.
Every Order shape is handled explicitly. Previously this only ever
called Object.keys()/Object.entries() on each item, which is correct
for the { field: 'DESC' } map form but silently mis-reads every other
one: a ['name', 'DESC'] tuple yielded its indices (ORDER BY "0" ASC)
and a bare 'name DESC' string yielded its character indices — ordering
by the wrong thing rather than failing.
Optional_options: BuildOptionsBuild an Oracle analytic/window function expression, e.g.
ROW_NUMBER() OVER (PARTITION BY "dept" ORDER BY "salary" DESC).
Build a WITH ... AS (...) common table expression clause and prepend it
to a main query. A CTE is made recursive simply by supplying
unionQuery (Oracle has no RECURSIVE keyword - the self-reference
inside the UNION ALL member is what makes it recursive).
Build an Oracle hierarchical query using START WITH ... CONNECT BY PRIOR,
the pre-recursive-CTE idiom Oracle has supported since 8i and still
commonly used/expected in Oracle codebases.
Build LIMIT/OFFSET clause using ROWNUM
Optionallimit: string | numberOptionaloffset: string | numberBuild INSERT query
Optionaloptions: InsertOptionsBuild UPDATE query
Optionaloptions: UpdateOptionsBuild DELETE query
Optionaloptions: DeleteOptionsBuild a general-purpose Oracle MERGE INTO ... USING ... ON (...) statement.
Supports composite (multi-column) match keys, conditional
WHEN [NOT] MATCHED predicates, and WHEN MATCHED ... THEN DELETE.
Build UPSERT query (MERGE for Oracle)
Optionaloptions: UpsertQueryOptionsBuild increment query
Optionaloptions: { by?: number }Replace placeholders in SQL
Optionalreplacements: unknown[] | Record<string, unknown>Create a PostgreSQL extension
Optional_options: anyDrop a PostgreSQL extension
Optional_options: anyGet all installed PostgreSQL extensions
Array of extension information
Check if a PostgreSQL extension is installed
True if the extension is installed
Optional_opts: anyOptional_opts: anyOptional_opts: anyOptional_opts: anyBuild a CREATE USER statement for Oracle.
Oracle syntax: CREATE USER username IDENTIFIED BY password
Build an ALTER USER statement for Oracle.
Oracle syntax: ALTER USER username IDENTIFIED BY password
Build a DROP USER statement for Oracle.
Return a query that lists all Oracle users.
Build a GRANT statement for Oracle.
Oracle syntax: GRANT privilege ON object TO user
Build a REVOKE statement for Oracle.
Oracle syntax: REVOKE privilege ON object FROM user
Build a SHOW GRANTS query for Oracle. Queries USER_TAB_PRIVS for object grants.
Optional_host: stringOracle does not require FLUSH PRIVILEGES - return a no-op.
Build a CREATE ROLE statement for Oracle.
Build a DROP ROLE statement for Oracle.
Return a query that lists all Oracle roles.
Drop a sequence.
Like the other DDL paths in this dialect (tables, users, roles), Oracle's
DROP SEQUENCE ... IF EXISTS syntax is 23c-only and raises ORA-00922
against the 19c/21c versions this dialect targets. When ifExists is
requested, wrap the plain DDL so that ORA-02289 ("sequence does not
exist") is silently ignored instead (see wrapIgnoringOraErrors).
Optionaloptions: DropSequenceOptionsOptionalschema: stringList all sequences in the database (Oracle)
Array of sequence names
Optionaloptions: DropStoredProcedureOptionsDrop a stored procedure (alias for dropStoredProcedure)
Optionaloptions: DropStoredProcedureOptionsCreate a stored procedure (alias for createStoredProcedure)
Optionalschema: stringOptionaloptions: DropTriggerOptionsOptionalschema: stringDrop a security policy
Optionaloptions: DropPolicyOptionsEnable Row-Level Security on a table
Optionalschema: stringDisable Row-Level Security on a table
Optionalschema: stringCheck if a policy exists
Add comment to a table
Add comment to a column
Partial indexes - not available on Oracle.
Oracle's CREATE INDEX has no WHERE clause; the equivalent is a
function-based index on a CASE expression that yields NULL for the rows to
exclude, since a B-tree index does not store all-NULL keys.
Optional_options: IndexOptionsCreate an expression index (functional index)
Optionaloptions: IndexOptionsCreate an identity column (auto-increment)
Optionaloptions: {Create a computed (virtual) column
Optionaloptions: { persisted?: boolean; type?: string }Bulk insert records into a table
Optional_options: anyAdd a foreign key to a table
Optionaloptions: {Rename a column
Create a fulltext index (Oracle uses Oracle Text)
Optionaloptions: { parser?: string; comment?: string }ST_Distance - calculate distance between two geometries (Oracle)
Optionalsrid: numberST_Within - check if geometry A is within geometry B (Oracle)
Optionalsrid: numberST_Contains - check if geometry A contains geometry B (Oracle)
Optionalsrid: numberST_Intersects - check if geometries intersect (Oracle)
Optionalsrid: numberST_DWithin - check if geometries are within a given distance (Oracle)
Optionalsrid: numberST_AsText - convert geometry to text representation (Oracle)
ST_GeomFromText - create geometry from text (Oracle)
Optionalsrid: numberBuild a JSON_TABLE expression to shred a JSON document/array into relational rows (Oracle 12c+). Useful to project a JSON array column into rows instead of a correlated subquery. Oracle: JSON_TABLE(expr, '$[*]' COLUMNS(name type PATH '$.path', ...)) alias
Build a LISTAGG(expr, delimiter) WITHIN GROUP (ORDER BY ...) expression
(Oracle 11gR2+), the standard idiom for collapsing grouped rows into a
single delimited string.
OptionalorderBy: OrderOptionaloverflow: stringBuild an Oracle PIVOT query, rotating rows into columns (11g+).
Build an Oracle UNPIVOT query, rotating columns into rows (11g+).
Build a scalar JSON_VALUE(column, '$.path' RETURNING type) accessor
(Oracle 12c+), the standard way to extract a scalar out of a JSON column.
Optionaloptions: { returning?: string; onError?: string }Build a JSON_QUERY(column, '$.path') accessor (Oracle 12c+) for extracting
a JSON object/array fragment (rather than a scalar) out of a JSON column.
Optionaloptions: { wrapper?: "WITH WRAPPER" | "WITHOUT WRAPPER" | "WITH CONDITIONAL WRAPPER" }Build a JSON_EXISTS(column, '$.path') predicate (Oracle 12c+) for use in a
WHERE clause to test for the presence of a JSON path.
Create an Oracle PL/SQL package specification and/or body. Emits
CREATE [OR REPLACE] PACKAGE name AS <spec> END; and, when body is given,
a following CREATE [OR REPLACE] PACKAGE BODY name AS <body> END;.
At least one of spec/body must be provided.
Drop an Oracle PL/SQL package. Pass bodyOnly to drop just the body and
keep the specification.
Optionaloptions: { schema?: string; bodyOnly?: boolean }Build an Oracle flashback AS OF clause (AS OF TIMESTAMP ... or
AS OF SCN ...) to append to a table reference for a point-in-time read.
Returns an empty string when neither timestamp nor SCN is given.
Build a flashback SELECT: SELECT ... FROM table AS OF ... [WHERE ...],
reading the table's rows as they existed at a past timestamp or SCN.
Optionaloptions: { schema?: string; attributes?: string[]; where?: WhereOptions }Flashback a table to a past point in time (FLASHBACK TABLE t TO TIMESTAMP/SCN ...).
Requires row movement enabled on the table.
Restore a dropped table from the recycle bin
(FLASHBACK TABLE t TO BEFORE DROP [RENAME TO newName]).
OptionalrenameTo: stringCreate an Oracle external table (ORGANIZATION EXTERNAL) — the native
Oracle mechanism for reading flat files / Data Pump dumps as a table, and
the recommended replacement for the PostgreSQL-only foreign-table API that
this dialect rejects.
Build an Oracle Text CONTAINS(column, 'query') > 0 predicate for use in a
WHERE clause against a CTXSYS.CONTEXT index (see createFulltextIndex).
label ties the predicate to a SCORE(label) projection.
Build an Oracle Text SCORE(label) projection expression that reports the
relevance score computed by a matching CONTAINS(..., label) predicate.
Oracle dialect class that implements the Dialect interface