Skip to content

Commit

Permalink
[PlSql] Fix split_table_partition clause (#3946)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasahsan123 authored Jan 27, 2024
1 parent 85de28c commit 1d96a08
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 6 additions & 6 deletions sql/plsql/PlSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3624,7 +3624,7 @@ system_partitioning
;

range_partition_desc
: PARTITION partition_name? range_values_clause table_partition_description (
: PARTITION partition_name? range_values_clause? table_partition_description? (
(
'(' (
range_subpartition_desc (',' range_subpartition_desc)*
Expand All @@ -3637,7 +3637,7 @@ range_partition_desc
;

list_partition_desc
: PARTITION partition_name? list_values_clause table_partition_description (
: PARTITION partition_name? list_values_clause? table_partition_description? (
(
'(' (
range_subpartition_desc (',' range_subpartition_desc)*
Expand Down Expand Up @@ -4764,10 +4764,10 @@ modify_table_partition
;

split_table_partition
: SPLIT PARTITION partition_name INTO '(' (
range_partition_desc (',' range_partition_desc)*
| list_partition_desc (',' list_partition_desc)*
) ')'
: SPLIT partition_extended_names (
AT '(' literal (',' literal)* ')' INTO '(' range_partition_desc (',' range_partition_desc)* ')'
| INTO '(' (range_partition_desc (',' range_partition_desc)* | list_partition_desc (',' list_partition_desc)* ) ')'
) (update_global_index_clause | update_index_clauses)?
;

truncate_table_partition
Expand Down
12 changes: 11 additions & 1 deletion sql/plsql/examples/alter_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,14 @@ ALTER TABLE employees

ALTER TABLE PTY_PD_IVSM_MAGR_INFO
DROP CONSTRAINT PK_PTY_PD_IVSM_MAGR_INFO
CASCADE DROP INDEX;
CASCADE DROP INDEX;

ALTER TABLE TABLE_NAME
SPLIT PARTITION TABLE_NAME_CURRENT AT (TO_DATE('20240116040241', 'YYYYMMDDHH24MISS'))
INTO (PARTITION TABLE_NAME_20240116040241, PARTITION TABLE_NAME_CURRENT)
UPDATE INDEXES;

ALTER TABLE TABLE_NAME
SPLIT PARTITION TABLE_NAME_CURRENT AT (TO_DATE('20240116040241', 'YYYYMMDDHH24MISS'))
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));

0 comments on commit 1d96a08

Please sign in to comment.