This is an example of what I am trying to achieve with lot of simplifications.
I have a table like this:
CREATE TABLE temp_pt
(
pt_key number PRIMARY KEY
, history VARCHAR(20)
, country VARCHAR(2)
, currency VARCHAR(3)
, settlementday VARCHAR(10)
);
There are some records in this table, say as follows:
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(1, 'MATCH', 'GB', 'GBP', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(2, 'MATCH', 'GB', 'GBP', '2021-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(3, 'MATCH', 'GB', 'EUR', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(4, 'MATCH', 'GB', 'EUR', '2021-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(5, 'MATCH', 'GI', 'GBP', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(6, 'MATCH', 'GI', 'GBP', '2021-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(7, 'MATCH', 'GI', 'EUR', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(8, 'MATCH', 'GI', 'EUR', '2021-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(9, 'MATCH', 'NL', 'GBP', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(10, 'MATCH', 'NL', 'GBP', '2021-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(11, 'MATCH', 'NL', 'EUR', '2020-12-01');
insert into temp_pt(PT_KEY, history, country, currency, settlementday) values(12, 'MATCH', 'NL', 'EUR', '2021-12-01');
I need all records with the settlementday > 2020-12-31 except those where (currency is GBP and country is GB or GI). How do I write this?