I have 2 types of value in the partition column of string datatype:
yyyyMMdd
yyyy-MM-dd
E.g. there are partition column values 20200301
, 2020-03-05
, 2020-05-07
, 20200701
, etc.
I need to drop partitions less than 20200501
with a DDL statement like
alter table tblnm drop partition(partcol < 20200501);
When I drop partitions using yyyy-MM-dd
format, only 2020-03-05
partition is dropped.
But when I drop partitions using yyyyMMdd
format, 20200301
is dropped as well as all the partitions containing hyphen (-
).
How to compare value by ignoring hyphen or by ignoring data that contains hyphen? I can replace hyphen in the alter table query if necessary.