Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Delete partitions based on the

curious_mindJul 2 2020 — edited Jul 2 2020

Hi,

I have a requirement where i have to delete data on the basis of the partitions, below is the structure of the table:

Desc IAA_TRANS;

Name                      Null    Type       

-------------------------- -------- -------------

TRAN_ID                    NOT NULL VARCHAR2(20)

TRAN_CNTX_CDE    NOT NULL VARCHAR2(10)

TRAN_EFCT_DTE     NOT NULL DATE       

FL_NBR                      NOT NULL NUMBER(38) 

BCH_DTE                   NOT NULL DATE       

TRAN_ENTR_DTE                        DATE       

TRAN_STAT_CDE                        CHAR(4)   

EODS_ACCT_ID                          NUMBER(38) 

DATA_GRP_CDE                         VARCHAR2(10)

CRTE_PGM               NOT NULL VARCHAR2(50)

CRTE_TSTP              NOT NULL DATE       

UPDT_PGM                                 VARCHAR2(50)

UPDT_TSTP                                DATE

select distinct data_grp_cde from IAA_TRANS;

VANTAGE FA

RPS

VANTAGE UL

BETA GROUP

TRAD

I have to retain the data where the data_grp_cde is BETA GROUP, rest i need to delete via partition drop.

As of now we are dropping the data straight away but first identifying the partitions from DBA_TAB_PARTITIONS and then issuing below command:

alter table '||in_schema_name||'.'||in_table_name||' drop partition '||in_partition_name;

Now the requirement is changes as i explained above, please suggest how to approach further with this.

Comments
Post Details
Added on Jul 2 2020
9 comments
926 views