Skip to content

Commit

Permalink
[PlSql] Support SUBPARTITION and CHECK clauses when altering table
Browse files Browse the repository at this point in the history
  • Loading branch information
vjuranek committed Oct 15, 2024
1 parent 30c6ea0 commit 12d625c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sql/plsql/PlSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -4006,7 +4006,9 @@ deallocate_unused_clause
;

shrink_clause
: SHRINK SPACE_KEYWORD COMPACT? CASCADE?
// CHECK is an internal Oracle option
// It is used to check for proper segment type and segment attributes to allow shrink
: SHRINK SPACE_KEYWORD (COMPACT | CASCADE | CHECK)?
;

records_per_block_clause
Expand Down Expand Up @@ -4792,7 +4794,7 @@ merge_table_partition

modify_table_partition
: MODIFY (
PARTITION partition_name ((ADD | DROP) list_values_clause)? (ADD range_subpartition_desc)? (
(PARTITION | SUBPARTITION) partition_name ((ADD | DROP) list_values_clause)? (ADD range_subpartition_desc)? (
REBUILD? UNUSABLE LOCAL INDEXES
)? shrink_clause?
| range_partitions
Expand Down
2 changes: 2 additions & 0 deletions sql/plsql/examples/alter_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,5 @@ UPDATE INDEXES (COST_IX (PARTITION C_P1 TABLESPACE TBS_02, PARTITION C_P2 TABLES
ALTER TABLE "AB01"."SMOSTAMM" ADD CONSTRAINT "CC_SMOSTAMM_KRAB" CHECK ((KRAB >= 0. ) AND (KRAB <= 100. )) ENABLE;

ALTER TABLE "ME_CARRIER_HISTORY" ADD CONSTRAINT "CHECK_COMM_TYPE" CHECK (communication_type in('EDI','NON-EDI','API')) NOVALIDATE PARALLEL;

ALTER TABLE NAV.SPAC_AUT_APOLICE MODIFY SUBPARTITION P12345 SHRINK SPACE CHECK;

0 comments on commit 12d625c

Please sign in to comment.