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 May 31, 2024
1 parent 7f01b95 commit ae5cef0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions sql/plsql/PlSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -4004,7 +4004,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 @@ -4790,7 +4792,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
4 changes: 3 additions & 1 deletion sql/plsql/examples/alter_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,6 @@ SPLIT PARTITION TABLE_NAME_CURRENT AT (TO_DATE('20240116040241', 'YYYYMMDDHH24MI
INTO (PARTITION TABLE_NAME_20240116040241, PARTITION TABLE_NAME_CURRENT)
UPDATE INDEXES (COST_IX (PARTITION C_P1 TABLESPACE TBS_02, PARTITION C_P2 TABLESPACE TBS_03));

ALTER TABLE "AB01"."SMOSTAMM" ADD CONSTRAINT "CC_SMOSTAMM_KRAB" CHECK ((KRAB >= 0. ) AND (KRAB <= 100. )) ENABLE;
ALTER TABLE "AB01"."SMOSTAMM" ADD CONSTRAINT "CC_SMOSTAMM_KRAB" CHECK ((KRAB >= 0. ) AND (KRAB <= 100. )) ENABLE;

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

0 comments on commit ae5cef0

Please sign in to comment.